Re: Set the log level based on command line args

2014-08-06 Thread Matt Sicker
ks. > > -Original Message- > From: Ralph Goers [mailto:ralph.go...@dslextreme.com] > Sent: Wednesday, August 06, 2014 1:17 PM > To: Log4J Users List > Subject: Re: Set the log level based on command line args > > I should also add that your configuration didn't show a

RE: Set the log level based on command line args

2014-08-06 Thread Arwen Pond
Do you have to specify a root logger in the configuration? additivity="false" solved my issue. Thanks. -Original Message- From: Ralph Goers [mailto:ralph.go...@dslextreme.com] Sent: Wednesday, August 06, 2014 1:17 PM To: Log4J Users List Subject: Re: Set the log level based

Re: Set the log level based on command line args

2014-08-06 Thread Ralph Goers
I should also add that your configuration didn’t show a root logger. There is always a root logger so I suspect you are also logging to it. If you make all your loggers be configured with additivity=“false” that should stop happening. Ralph On Aug 6, 2014, at 1:13 PM, Ralph Goers wrote: > P

Re: Set the log level based on command line args

2014-08-06 Thread Ralph Goers
Please see http://logging.apache.org/log4j/2.x/manual/configuration.html#Additivity Ralph On Aug 6, 2014, at 10:42 AM, Arwen Pond wrote: > I am investigating migrating from log4j 1 to log4j 2. A pattern that I have > in many of my applications is setting the log level based on command line

RE: Set the log level based on command line args

2014-08-06 Thread Arwen Pond
But I see duplicated lines in the output. INFO [main]: Hello World 11:36:18.191 [main] INFO verbose - Hello World What am I doing wrong? Thanks, Arwen -Original Message- From: Arwen Pond Sent: Wednesday, August 06, 2014 10:42 AM To: log4j-user@logging.apache.org Subject: Set the log level b

Set the log level based on command line args

2014-08-06 Thread Arwen Pond
I am investigating migrating from log4j 1 to log4j 2. A pattern that I have in many of my applications is setting the log level based on command line arguments. So if the -v (verbose) option is passed I set the log level to Info. The default is set to warn. if (line.hasOption("v")) {