Re: problems with web app and JndiContextSelector

2014-08-06 Thread Mike Calmus
After extensive trial and error I think I have things boiled down. In my list works means that I see logging. For some there may be caveats. All tests were run using Weblogic 10.3.6 (a Servlet 2.5 container) running on Java 7. There were no difference when using Log4j 2.0 versus 2.0.1. When I

Re: problems with web app and JndiContextSelector

2014-08-06 Thread Matt Sicker
Are system libraries in Weblogic loaded as OSGi bundles? On 6 August 2014 11:39, Mike Calmus m...@calmus.org wrote: After extensive trial and error I think I have things boiled down. In my list works means that I see logging. For some there may be caveats. All tests were run using Weblogic

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)) {

RE: Set the log level based on command line args

2014-08-06 Thread Arwen Pond
This is what I have tried: ?xml version=1.0 encoding=UTF-8? Configuration Appenders Console name=Console target=SYSTEM_OUT PatternLayout pattern=%-5p [%t]: %m%n/ /Console /Appenders Loggers Logger name=debug level=debug AppenderRef

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 ap...@book.com 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

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

Re: how to change logging level for a class at runtime [I]

2014-08-06 Thread Ang Xu
Hi, Is there any plan to merge this patch to the main branch? This functionality seems extremely useful when modifying config file is not an option. Thanks, Ang On 6/25/14, 12:19 AM, Phil Wray phil.w...@db.com wrote: Classification: For internal use only Hey Ralph. Sure - have created:

Set the file name based on command line args

2014-08-06 Thread Arwen Pond
My application takes a parameter where the user can specify the log file. I'd like to pass this parameter to the Logger which uses a FileAppender. I am not sure how to do this in log4j 2. Thanks, Arwen This electronic mail message contains information that (a) is or may be CONFIDENTIAL,

Re: problems with web app and JndiContextSelector

2014-08-06 Thread Mike Calmus
I don't know for sure, but based upon my reading online it appears that may be a new feature for 12c which we are not yet using. On Wed, Aug 6, 2014 at 1:33 PM, Matt Sicker boa...@gmail.com wrote: Are system libraries in Weblogic loaded as OSGi bundles? On 6 August 2014 11:39, Mike Calmus

Re: how to change logging level for a class at runtime [I]

2014-08-06 Thread Ralph Goers
I wouldn’t have asked for a patch submission if I didn’t plan to consider it. That said, we are all volunteers here and sometimes don’t get to things as quickly as we would like. Ralph On Aug 6, 2014, at 1:24 PM, Ang Xu a...@linkedin.com.INVALID wrote: Hi, Is there any plan to merge this

Re: Set the file name based on command line args

2014-08-06 Thread Gary Gregory
I wonder if we could write a MainArgumentsLookup that finds the main thread and walks up the stack to the public static main(String[]) main methods and gets the arguments from the stack... Gary On Wed, Aug 6, 2014 at 6:54 PM, Ralph Goers ralph.go...@dslextreme.com wrote: Well…. You would

Re: Set the file name based on command line args

2014-08-06 Thread Ralph Goers
Wouldn’t it be easier to have a Lookup that your main called and just passed the arguments? But yeah, it should be possible to do what you are suggesting. Ralph On Aug 6, 2014, at 4:09 PM, Gary Gregory garydgreg...@gmail.com wrote: I wonder if we could write a MainArgumentsLookup that finds

Re: Set the file name based on command line args

2014-08-06 Thread Gary Gregory
Yes you are right but the stack walker could be used even if you do not control to source for main. Maybe a script calls a main and then my app plugin gets called and I want to also follow the verbose command line setting. Gary div Original message /divdivFrom: Ralph Goers

Re: Set the file name based on command line args

2014-08-06 Thread Remko Popma
I don't follow... If you walk the stack trace you can find the name of the original class whose main() method was called, but how would that give you access to the main method's parameter values? Sent from my iPhone On 2014/08/07, at 9:26, Gary Gregory garydgreg...@gmail.com wrote: Yes you

Re: Set the file name based on command line args

2014-08-06 Thread Gary Gregory
With some debug API hackery: http://docs.oracle.com/javase/7/docs/jdk/api/jpda/jdi/com/sun/jdi/StackFrame.html Gary On Wed, Aug 6, 2014 at 8:36 PM, Remko Popma remko.po...@gmail.com wrote: I don't follow... If you walk the stack trace you can find the name of the original class whose main()

Re: Set the file name based on command line args

2014-08-06 Thread Remko Popma
Oooh... A little naughty, but a lot of fun! :-) Thanks for the pointer! Sent from my iPhone On 2014/08/07, at 9:44, Gary Gregory garydgreg...@gmail.com wrote: With some debug API hackery: http://docs.oracle.com/javase/7/docs/jdk/api/jpda/jdi/com/sun/jdi/StackFrame.html Gary On Wed,

Re: Set the file name based on command line args

2014-08-06 Thread Gary Gregory
And worse: vendor specific! Gary On Wed, Aug 6, 2014 at 9:05 PM, Remko Popma remko.po...@gmail.com wrote: Oooh... A little naughty, but a lot of fun! :-) Thanks for the pointer! Sent from my iPhone On 2014/08/07, at 9:44, Gary Gregory garydgreg...@gmail.com wrote: With some debug

Re: Set the file name based on command line args

2014-08-06 Thread Matt Sicker
Hey, it's better than having to use sun.util.Reflection! On 6 August 2014 20:19, Gary Gregory garydgreg...@gmail.com wrote: And worse: vendor specific! Gary On Wed, Aug 6, 2014 at 9:05 PM, Remko Popma remko.po...@gmail.com wrote: Oooh... A little naughty, but a lot of fun! :-) Thanks

Re: Set the log level based on command line args

2014-08-06 Thread Matt Sicker
I'm pretty sure the root logger has an implicit default configuration if it's missing from your config file. On 6 August 2014 15:57, Arwen Pond ap...@book.com wrote: Do you have to specify a root logger in the configuration? additivity=false solved my issue. Thanks. -Original

Re: problems with web app and JndiContextSelector

2014-08-06 Thread Matt Sicker
Oh, well that wouldn't really help things at this point as I think there are still some strange issues in the OSGi support in Log4j anyhow. I'll see if I can take a look at this since we use the same version of Weblogic at my work (thus I actually know a little bit about this application). On 6