how to reinitialize log4j2 configuration?

2015-06-05 Thread Benjamin Jaton
Hello After an initial configuration of log4j2 with: Configurator.initialize(null, configLocation); I would like to reinitialize it with a different URL Configurator.initialize(null, configLocation2); The problem is that the second call is ignored. I believe that once the

SMTP appender + filter

2015-06-25 Thread Benjamin Jaton
Hello, I am trying to create a filter at the appender level that would show all the messages that contain Show. This is my test: LogManager.getLogger(Test.class).debug(Hide me!); LogManager.getLogger(Test.class).info(test); LogManager.getLogger(Test.class).debug(Show me

Re: SMTP appender + filter

2015-06-26 Thread Benjamin Jaton
. No debug events will make it past that. Ralph On Jun 25, 2015, at 3:39 PM, Benjamin Jaton benjamin.ja...@gmail.com wrote: Hello, I am trying to create a filter at the appender level that would show all the messages that contain Show. This is my test: LogManager.getLogger

Re: how to reinitialize log4j2 configuration?

2015-06-16 Thread Benjamin Jaton
, Benjamin Jaton benjamin.ja...@gmail.com wrote: Hello After an initial configuration of log4j2 with: Configurator.initialize(null, configLocation); I would like to reinitialize it with a different URL Configurator.initialize(null, configLocation2); The problem

Re: RollingFileAppeneder MaxSize + keep 30 days

2015-07-03 Thread Benjamin Jaton
2015 23:54, at 23:54, Benjamin Jaton benjamin.ja...@gmail.com wrote: Hello, How can I define a RollingFileAppender that would roll when it reaches 100MB, and that would discard any log older than 30 days (not before)? I need to keep 30 days of logs for auditing purposes, but I also want

RollingFileAppeneder MaxSize + keep 30 days

2015-07-02 Thread Benjamin Jaton
Hello, How can I define a RollingFileAppender that would roll when it reaches 100MB, and that would discard any log older than 30 days (not before)? I need to keep 30 days of logs for auditing purposes, but I also want to limit the logs to a certain size as well. Thanks! Ben

Re: RollingFileAppeneder MaxSize + keep 30 days

2015-07-06 Thread Benjamin Jaton
Bump. So far my only option is to not use a size limit at all, and only use a 1 per day policy and keep 30 files. Any pointer would be greatly appreciated. On Fri, Jul 3, 2015 at 4:51 PM, Benjamin Jaton benjamin.ja...@gmail.com wrote: I'm sorry my question was for log4j2, I should have been

Re: JDBC Appender : how to have the pattern produce NULL?

2015-07-22 Thread Benjamin Jaton
a custom PatternConverter. On Tue, Jul 21, 2015 at 5:21 PM, Remko Popma remko.po...@gmail.com wrote: Have you tried ThreadContext.remove(NUM)? Remko Sent from my iPhone On 2015/07/22, at 7:45, Benjamin Jaton benjamin.ja...@gmail.com wrote: Hello, I am using the JDBCAppender

File monitor - reload DefaultRolloverStrategy

2015-07-24 Thread Benjamin Jaton
Hello, I am using this configuration : ?xml version=1.0 encoding=UTF-8? Configuration status=DEBUG* monitorInterval=2* Appenders RollingFile name=RollingFile fileName=/tmp/test/app.log filePattern=/tmp/test/app.log.%i PatternLayout Pattern%d %p %c{1.} [%t] %m%n/Pattern

Re: Log4j2 - HTML emails pattern

2015-11-10 Thread Benjamin Jaton
? > > Gary > > On Mon, Nov 9, 2015 at 11:09 AM, Benjamin Jaton <benjamin.ja...@gmail.com> > wrote: > > > Thanks the feedback. > > I found that the easiest way to achieve this was to have the > PatternLayout > > class support to set the conten

RollingFileAppender maxDelayMillis?

2015-11-10 Thread Benjamin Jaton
Hi, I am wondering if it would make sense to have a maxDelayMillis parameter for the RollingFileAppender (like FlumeAppender). Use case: You have a web server access log, you produce an HTTP request and expect to see it (and the response) in the access logs right away-ish (or at least control

Re: Log4j2 - HTML emails pattern

2015-11-09 Thread Benjamin Jaton
that > layout with the SMTP appender. > > This manual page may be a good place to get started: > http://logging.apache.org/log4j/2.x/manual/extending.html#Layouts > > Best regards, > Remko > > > On 2015/11/06, at 4:55, Benjamin Jaton <benjamin.ja...@gmail.com> wro

Re: RollingFileAppender maxDelayMillis?

2015-11-11 Thread Benjamin Jaton
Thanks a lot for the explanation, much clearer now. Here is the JIRA: https://issues.apache.org/jira/browse/LOG4J2-1197 On Tue, Nov 10, 2015 at 11:39 PM, Remko Popma <remko.po...@gmail.com> wrote: > On Wed, Nov 11, 2015 at 2:34 PM, Benjamin Jaton <benjamin.ja...@gmail.com> > w

Re: RollingFileAppender maxDelayMillis?

2015-11-10 Thread Benjamin Jaton
OK I will create a Jira for this. > > Remko > > > On 2015/11/11, at 5:16, Gary Gregory <garydgreg...@gmail.com> wrote: > > > > And more generally, can all appenders benefit from such a setting? > > > > Gary > > > > On Tue, Nov 10, 2015 at 11:0

Re: Log4j2 - HTML emails pattern

2015-11-10 Thread Benjamin Jaton
just use the PatternLayout and > interweave HTML? > On 10 November 2015 at 11:57, Benjamin Jaton <benjamin.ja...@gmail.com> > wrote: > > > I am trying to use a logger in order to send "alerts" to the user. So for > > me 1 log = 1 email (hence LOG4J2-1071). > > I use

Log4j2 - HTML emails pattern

2015-11-05 Thread Benjamin Jaton
Hi, I am using the SMTPAppender with a custom pattern: "PatternLayout" : { "pattern" : "%m" } But the email is sent as text. I saw that there is a HTMLLayout but it doesn't seem to accept a pattern? How can I produce a custom HTML message? Thanks! Ben

Re: Log4j2 set log level, cascade

2015-10-20 Thread Benjamin Jaton
ing, > Level) and setLevel(). > > Gary > > On Tue, Oct 20, 2015 at 3:13 PM, Benjamin Jaton <benjamin.ja...@gmail.com> > wrote: > > >

Log4j2 set log level, cascade

2015-10-20 Thread Benjamin Jaton
Hello, Here is a simple configuration: ** ** ** I am trying to programmatically set the log level of "com.rli", but I can't find the Loggers until they are used:

Reloading appender after property value changes

2016-06-27 Thread Benjamin Jaton
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" :

Re: Reloading appender after property value changes

2016-06-27 Thread Benjamin Jaton
er solution, though. You can programmatically cause a > reconfiguration as well. > > On 27 June 2016 at 13:17, Benjamin Jaton <benjamin.ja...@gmail.com> wrote: > > > Hello, > > > > I have a simple appender like: > > > > { > >

Log4j2 ThreadContext for child threads

2016-04-26 Thread Benjamin Jaton
Hi all, I am using the ThreadContext a lot, but I am sometimes in a situation where I would need to set some variable for a task that runs in a thread that might spawn children threads. I need that logging variable to be also available to those child threads. Unless I create the sub threads

Re: Log4j2 ThreadContext for child threads

2016-04-27 Thread Benjamin Jaton
> > http://logging.apache.org/log4j/2.x/manual/thread-context.html > > > Sent from my iPhone > > > On 2016/04/27, at 8:58, Benjamin Jaton <benjamin.ja...@gmail.com> wrote: > > > > Hi all, > > > > I am using the ThreadContext a lot, but I am sometimes in a sit

Re: Reloading appender after property value changes

2016-06-28 Thread Benjamin Jaton
gt; > > 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", > >

Re: Reloading appender after property value changes

2016-06-28 Thread Benjamin Jaton
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 > >

Sharing common log4j2 configuration

2016-06-29 Thread Benjamin Jaton
Hello again, Is there a way to define a set appenders/logger/props and use them in several log4j2 configuration files? Like: I define sub-conf C Then I create conf A that "imports" C, and conf B that "imports" C as well. I know about x:include (https://issues.apache.org/jira/browse/LOG4J2-341),

Re: Sharing common log4j2 configuration

2016-06-29 Thread Benjamin Jaton
ee > http://logging.apache.org/log4j/2.x/manual/configuration.html#CompositeConfiguration > . > > Ralph > > > On Jun 29, 2016, at 3:00 PM, Benjamin Jaton <benjamin.ja...@gmail.com> > wrote: > > > > Hello again, > > > > Is there a way to define

SMTP appender and TLS

2017-02-21 Thread Benjamin Jaton
Hello, Is there a way to use TLS when sending emails through the SMTP appender? https://logging.apache.org/log4j/2.x/manual/appenders.html#SMTPAppender Thanks Benjamin

DefaultRolloverStrategy.createStrategy - access the appender

2016-10-07 Thread Benjamin Jaton
Hello, When configuring the rollover strategy for an appender, is there a way to access the name of the appender from this method: DefaultRolloverStrategy.createStrategy ? I'm trying to write my own and I could use that name for my implementation. Thanks, Benjamin

Log4j2 script to generate hash

2016-11-08 Thread Benjamin Jaton
hello, I was playing with log4j2 filters to generate a hash in groovy that I would put in the threadcontext map, and then use in my log pattern: %d{-MM-dd HH:mm:ss} %-5p %c{1.}:%L - %m [%X{myhash}] But the hash is printed on the NEXT log message. My understanding is that at this point the

Re: Log4j2 script to generate hash

2016-11-08 Thread Benjamin Jaton
s. Different > parameters are passed to these methods. > > Sent from my iPhone > > > On 9 Nov 2016, at 8:57, Benjamin Jaton <benjamin.ja...@gmail.com> wrote: > > > > Ah, interesting. I seem to be able to make modification using this global > > filter. > &

Re: Log4j2 script to generate hash

2016-11-08 Thread Benjamin Jaton
As far as I know, there is no way for a global filter to know which logger we're working it for. Which in my case is not the best since I would compute a hash for all the messages of all my loggers, instead of just the one I need them for. On Tue, Nov 8, 2016 at 4:30 PM, Benjamin Jaton

Re: Log4j2 script to generate hash

2016-11-08 Thread Benjamin Jaton
. Please try that. > > Remko > > Sent from my iPhone > > > On 9 Nov 2016, at 7:02, Benjamin Jaton <benjamin.ja...@gmail.com> wrote: > > > > I am applying it on the root logger. > > > >> On Tue, Nov 8, 2016 at 12:47 PM, Matt Sicker <boa...@gmail.com

Re: Log4j2 script to generate hash

2016-11-08 Thread Benjamin Jaton
I am applying it on the root logger. On Tue, Nov 8, 2016 at 12:47 PM, Matt Sicker <boa...@gmail.com> wrote: > Where are you applying the filter? On the appender or somewhere else? > > On 8 November 2016 at 13:13, Benjamin Jaton <benjamin.ja...@gmail.com> > wrote

Re: Log4j2 script to generate hash

2016-11-09 Thread Benjamin Jaton
one > > > On 9 Nov 2016, at 9:45, Benjamin Jaton <benjamin.ja...@gmail.com> wrote: > > > > As far as I know, there is no way for a global filter to know which > logger > > we're working it for. > > Which in my case is not the best since I would comput

Re: Log4j2 script to generate hash

2016-11-10 Thread Benjamin Jaton
;INFO", "additivity" : "false", "includeLocation" : "true", "AppenderRef" : { "ref" : "STDOUT" } } } } } On Thu, Nov

Re: Log4j2 script to generate hash

2016-11-10 Thread Benjamin Jaton
/src/main/java/org/apache/logging/log4j/core/ > filter/ScriptFilter.java > > > > > Sent from my iPhone > > > On 11 Nov 2016, at 7:15, Benjamin Jaton <benjamin.ja...@gmail.com> > wrote: > > > > Sure, here it is: > > > > { > &

Re: Log4j2 script to generate hash

2016-11-10 Thread Benjamin Jaton
quot; : { "ref" : "STDOUT" } } } } } The output without the highlighted section: test (Logger log level = INFO) The output with the highlighted section: 2016-11-10 16:30:25,351 main WARN Error while converting string [${server.log.level}

Re: Log4j2 script to generate hash

2016-11-10 Thread Benjamin Jaton
Phone > > > On 10 Nov 2016, at 4:31, Benjamin Jaton <benjamin.ja...@gmail.com> > wrote: > > > > Hmm, I'm not sure, I tried to do this in groovy: > > > > println(args[0]) > > > > But I get: > > Caused by: groo

DefaultRolloverStrategy max attribute and IfAccumulatedFileCount

2016-10-18 Thread Benjamin Jaton
Hello, I wonder about the relationship between the max attribute and the IfAccumulatedFileCount. I had wrongly assumed that if you used the Delete policy, then the max attribute wasn't needed. But that resulted in having a cap on the number of log files to 7 (which is the DEFAULT_WINDOW_SIZE in

Re: Log4j2 script to generate hash

2016-11-11 Thread Benjamin Jaton
Reported here: https://issues.apache.org/jira/browse/LOG4J2-1693 On Thu, Nov 10, 2016 at 5:15 PM, Matt Sicker <boa...@gmail.com> wrote: > Please do open an issue. Otherwise, this will probably get lost in the > mailing lists. > > On 10 November 2016 at 18:33, Benjamin

Re: ClassNotFoundException trying to use JDBC appender

2016-11-29 Thread Benjamin Jaton
Would that help? http://stackoverflow.com/questions/24179375/eclipse-rcp-java-lang-classnotfoundexception-a-runtime in particular: Bundle-ClassPath: .,lib/library.jar On Tue, Nov 29, 2016 at 4:48 PM, Gary Gregory wrote: > OSGi and class loaders make for complications

Log4j2 RollingFileAppender message not in order?

2017-12-14 Thread Benjamin Jaton
Hello, I am seeing logs that are not in order in the log file, it this expected when using a RollingFile appender? "appenders" : { "appender" : [ { "type" : "RollingFile", "name" : "ServerAppender", "PatternLayout" : { "pattern" : "%d{-MM-dd

Re: Log4j2 RollingFileAppender message not in order?

2017-12-14 Thread Benjamin Jaton
ss the event to the appender. Are you seeing log > entries that are out of order in the same thread? That shouldn’t happen. > > > > Ralph > > > >> On Dec 14, 2017, at 3:09 PM, Benjamin Jaton <benjamin.ja...@gmail.com> > wrote: > >> > >