Alright, thanks for you feedback.

Here is the JIRA: https://issues.apache.org/jira/browse/LOG4J2-1450

On Tue, Jun 28, 2016 at 3:41 PM, Remko Popma <remko.po...@gmail.com> wrote:

> I see. With current log4j, you'd need to reload the config then.
>
> I wouldn't like to implement reloading just one appender (but perhaps
> others think differently).
>
> Without looking at the code, supporting dynamically evaluation of double
> $'s in SmtpAppender seems like a good approach. Can you raise a Jira
> feature request for that?
>
> Sent from my iPhone
>
> > On 2016/06/29, at 1:33, Benjamin Jaton <benjamin.ja...@gmail.com> wrote:
> >
> > Ah I forgot about this trick.
> >
> > It doesn't seem to be supported by the SMTPAppender:
> >
> >
> ---------------------------------------------------------------------------
> > 2016-06-28 09:30:06,562 main ERROR SmtpManager
> > SMTP:5bea43473970a15b1a4dbd9dcce1c4f6 caught exception while sending
> e-mail
> > notification.: javax.mail.SendFailedException: Invalid Addresses;
> >  nested exception is:
> >    com.sun.mail.smtp.SMTPAddressFailedException: 553-5.1.2 The recipient
> > address <${email.recipient}> is not a valid
> > 553 5.1.2 RFC-5321 address. t128sm520507pfb.14 - gsmtp
> > javax.mail.SendFailedException: Invalid Addresses;
> >  nested exception is:
> >    com.sun.mail.smtp.SMTPAddressFailedException: 553-5.1.2 *The recipient
> > address <${email.recipient}> is not a valid*
> > 553 5.1.2 RFC-5321 address. t128sm520507pfb.14 - gsmtp
> >
> >    at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1996)
> >    at
> com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1240)
> >    at javax.mail.Transport.send0(Transport.java:255)
> >    at javax.mail.Transport.send(Transport.java:124)
> >    at
> >
> org.apache.logging.log4j.core.net.SmtpManager.sendMultipartMessage(SmtpManager.java:257)
> >    at
> >
> org.apache.logging.log4j.core.net.SmtpManager.sendEvents(SmtpManager.java:172)
> >    at
> >
> org.apache.logging.log4j.core.appender.SmtpAppender.append(SmtpAppender.java:177)
> >    at
> >
> org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:155)
> >    at
> >
> org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:128)
> >    at
> >
> org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:119)
> >    at
> >
> org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
> >    at
> >
> org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:390)
> >    at
> >
> org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:375)
> >    at
> >
> org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:359)
> >    at
> >
> org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:349)
> >    at
> >
> org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63)
> >    at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146)
> >    at
> >
> org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2002)
> >    at
> >
> org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1974)
> >    at
> >
> org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:738)
> >    at Test.main(Test.java:19)
> > Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 553-5.1.2 The
> > recipient address <${email.recipient}> is not a valid
> > 553 5.1.2 RFC-5321 address. t128sm520507pfb.14 - gsmtp
> >
> >    at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1849)
> >    ... 20 more
> >
> ---------------------------------------------------------------------------
> >
> >
> > Or when I try it with the port:
> >
> >
> ---------------------------------------------------------------------------
> > 2016-06-28 09:29:03,268 main ERROR *Could not parse "${email.smtp.port}"
> *as
> > an integer,  using default value 0: java.lang.NumberFormatException: For
> > input string: "${email.smtp.port}"
> >
> ---------------------------------------------------------------------------
> >
> >
> >
> > Thanks
> > Ben
> >
> >
> >> On Mon, Jun 27, 2016 at 3:36 PM, Remko Popma <remko.po...@gmail.com>
> wrote:
> >>
> >> Have you tried configuring with two leading '$' characters?
> >>
> >>
> http://logging.apache.org/log4j/2.x/manual/configuration.html#RuntimeLookup
> >>
> >>
> >> Sent from my iPhone
> >>
> >>> On 2016/06/28, at 3:17, Benjamin Jaton <benjamin.ja...@gmail.com>
> wrote:
> >>>
> >>> Hello,
> >>>
> >>> I have a simple appender like:
> >>>
> >>> {
> >>>       "type" : "smtp",
> >>>       "name" : "EmailAppender",
> >>>       "subject" : "${email.subject}",
> >>>       "to" : "${email.recipient}",
> >>>       "from" : "${email.from}",
> >>>       "smtpProtocol" : "${email.smtp.protocol}",
> >>>       "smtpHost" : "${email.smtp.host}",
> >>>       "smtpPort" : "${email.smtp.port}",
> >>>       "smtpUsername" : "${email.smtp.username}",
> >>>       "smtpPassword" : "${email.smtp.password}"
> >>> }
> >>>
> >>> When I have a updated value for one of those property (for example
> >>> ${email.subject} has changed, what's the simplest way to reload the
> >>> appender so that it takes that new value?
> >>> Do we have to force a full reconfiguration?
> >>>
> >>> Thanks
> >>> Ben
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> >> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>

Reply via email to