logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Logging some packages to File
Date Sun, 30 May 2010 05:21:26 GMT
Correct...

-Dlog4j.configuration=file:/u02/oracle/user_projects/log4j.properties


Jake

On 5/27/2010 9:29 AM, Douglas E Wegscheid wrote:
> log4j.configuration takes a URL, not a file path?
> 
> Douglas E Wegscheid
> Lead Technical Analyst, Whirlpool Corporation
> (269)-923-5278
> 
> "A wrong note played hesitatingly is a wrong note. A wrong note played 
> with conviction is interpretation."
> 
> 
> 
> 
> 
> fmarchioni <f.marchioni@pride.it> 
> 05/27/2010 09:10 AM
> Please respond to
> "Log4J Users List" <log4j-user@logging.apache.org>
> 
> 
> To
> log4j-user@logging.apache.org
> cc
> 
> Subject
> Re: Logging some packages to File
> 
> 
> 
> 
> 
> 
> 
> Hi all,
> thanks a lot for your reply. I have corrected the configuration 
> accordingly
> so that loggers
> are defined for the two main packages:
> 
> log4j.rootCategory=DEBUG
> 
> log4j.category.hibernate.objects=DEBUG,A2
> log4j.category.iceObjects=DEBUG,A2
> 
> .....
> However the file log4j.properties doesn't get picked by the classloader.
> 
> I've tried also setting the property
> -Dlog4j.configuration=/u02/oracle/user_projects/log4j.properties
> and adding the folder in the CLASSPATH variable
> 
> but still Weblogic cannot pickup the file at startup:
> 
> log4j: Trying to find [/u02/oracle/user_projects/log4j.properties] using
> sun.misc.Launcher$AppClassLoader@d9f9c3 class loader.
> log4j: Trying to find [/u02/oracle/user_projects/log4j.properties] using
> ClassLoader.getSystemResource().
> log4j: Could not find resource:
> [/u02/oracle/user_projects/log4j.properties].
> 
> Is there anything else I can try to let WLS pickup the file ?
> thanks a lot
> Federico
> 
> 
> 
> Douglas E Wegscheid wrote:
>>
>> log4j.category.hibernate.objects and log4j.category.iceObjects are set 
>> twice, the second setting has no appenders specified. You also have no 
>> appender for the root (which may or may not be what you want)
>>
>> put together a standalone program that uses this configuration, and run 
> it 
>> with log4j.debug=true, you should get some good output as to what you 
> are 
>> getting for configuration.
>>
>> log4j: Trying to find [log4j.xml] using context classloader 
>> sun.misc.Launcher$AppClassLoader@11b86e7.
>> log4j: Trying to find [log4j.xml] using 
>> sun.misc.Launcher$AppClassLoader@11b86e7 class loader.
>> log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
>> log4j: Trying to find [log4j.properties] using context classloader 
>> sun.misc.Launcher$AppClassLoader@11b86e7.
>> log4j: Using URL 
>> [file:/D:/data/Workspace-GJobs/Scratch/bin/log4j.properties] for 
> automatic 
>> log4j configuration.
>> log4j: Reading configuration from URL 
>> file:/D:/data/Workspace-GJobs/Scratch/bin/log4j.properties
>> log4j: Parsing for [root] with value=[DEBUG].
>> log4j: Level token is [DEBUG].
>> log4j: Category root set to DEBUG
>> log4j: Parsing for [iceObjects] with value=[DEBUG].
>> log4j: Level token is [DEBUG].
>> log4j: Category iceObjects set to DEBUG
>> log4j: Handling log4j.additivity.iceObjects=[null]
>> log4j: Parsing for [hibernate.objects] with value=[DEBUG].
>> log4j: Level token is [DEBUG].
>> log4j: Category hibernate.objects set to DEBUG
>> log4j: Handling log4j.additivity.hibernate.objects=[null]
>> log4j: Finished configuring.
>>
>> none of the categories have appenders, and no appenders are made (since 
>> none are referenced)
>>
>> if you correct it to,
>>
>> #I want to log statements with DEBUG or higher level
>> log4j.category.hibernate.objects=DEBUG, A2
>> log4j.category.iceObjects=DEBUG, A2
>>
>> you get
>>
>> log4j: Trying to find [log4j.xml] using context classloader 
>> sun.misc.Launcher$AppClassLoader@11b86e7.
>> log4j: Trying to find [log4j.xml] using 
>> sun.misc.Launcher$AppClassLoader@11b86e7 class loader.
>> log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
>> log4j: Trying to find [log4j.properties] using context classloader 
>> sun.misc.Launcher$AppClassLoader@11b86e7.
>> log4j: Using URL 
>> [file:/D:/data/Workspace-GJobs/Scratch/bin/log4j.properties] for 
> automatic 
>> log4j configuration.
>> log4j: Reading configuration from URL 
>> file:/D:/data/Workspace-GJobs/Scratch/bin/log4j.properties
>> log4j: Parsing for [root] with value=[DEBUG].
>> log4j: Level token is [DEBUG].
>> log4j: Category root set to DEBUG
>> log4j: Parsing for [iceObjects] with value=[DEBUG, A2].
>> log4j: Level token is [DEBUG].
>> log4j: Category iceObjects set to DEBUG
>> log4j: Parsing appender named "A2".
>> log4j: Parsing layout options for "A2".
>> log4j: Setting property [conversionPattern] to [%p %t %c - %m%n].
>> log4j: End of parsing for "A2".
>> log4j: Setting property [file] to 
>> [/u02/oracle/user_projects/domains/NMS/application.log].
>> log4j: Setting property [maxFileSize] to [500KB].
>> log4j: setFile called: 
>> /u02/oracle/user_projects/domains/NMS/application.log, true
>> log4j: setFile ended
>> log4j: Parsed "A2" options.
>> log4j: Handling log4j.additivity.iceObjects=[null]
>> log4j: Parsing for [hibernate.objects] with value=[DEBUG, A2].
>> log4j: Level token is [DEBUG].
>> log4j: Category hibernate.objects set to DEBUG
>> log4j: Parsing appender named "A2".
>> log4j: Appender "A2" was already parsed.
>> log4j: Handling log4j.additivity.hibernate.objects=[null]
>> log4j: Finished configuring.
>>
>> and you can see that the A2 appender is instantiated and set up.
>>
>> Douglas E Wegscheid
>> Lead Technical Analyst, Whirlpool Corporation
>> (269)-923-5278
>>
>> "A wrong note played hesitatingly is a wrong note. A wrong note played 
>> with conviction is interpretation."
>>
>>
>>
>>
>>
>> fmarchioni <f.marchioni@pride.it> 
>> 05/26/2010 09:02 AM
>> Please respond to
>> "Log4J Users List" <log4j-user@logging.apache.org>
>>
>>
>> To
>> log4j-user@logging.apache.org
>> cc
>>
>> Subject
>> Logging some packages to File
>>
>>
>>
>>
>>
>>
>>
>> Hi all !
>> I have the need to write logs from some packages in a file so I have
>> elaborated this log4j.properties file :
>>
>> log4j.rootCategory=DEBUG
>>
>> #I want to log information from packages hibernate.objects.* and from
>> iceObjects.*
>> log4j.category.hibernate.objects=INHERITED,A2
>> log4j.category.iceObjects=INHERITED,A2
>>
>> #I want to log statements with DEBUG or higher level
>> log4j.category.hibernate.objects=DEBUG
>> log4j.category.iceObjects=DEBUG
>>
>> log4j.appender.A1=org.apache.log4j.ConsoleAppender
>> log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>> log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
>>
>>
>> log4j.appender.A2=org.apache.log4j.RollingFileAppender
>>
> log4j.appender.A2.File=/u02/oracle/user_projects/domains/NMS/application.log
>> log4j.appender.A2.layout=org.apache.log4j.PatternLayout
>> log4j.appender.A2.layout.ConversionPattern=%p %t %c - %m%n
>> log4j.appender.A2.MaxFileSize=500KB
>>
>>
>> The packages I'm interested to log are those beginning with iceObjects.* 
> 
>> and
>> hibernate.objects.*
>> I've put this log4j.properties file in the WEB-INF/classes folder and
>> deployed the web application on Oracle Weblogic.
>>
>> However the log file application.log is never created. Can anybody give 
> me 
>> a
>> hint ? is the file correct ?
>> thanks a lot
>> Federico
>> -- 
>> View this message in context: 
>>
> http://old.nabble.com/Logging-some-packages-to-File-tp28680496p28680496.html
> 
>>
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
>>
>>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message