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$appclassloa...@11b86e7.
log4j: Trying to find [log4j.xml] using 
sun.misc.launcher$appclassloa...@11b86e7 class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader 
sun.misc.launcher$appclassloa...@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$appclassloa...@11b86e7.
log4j: Trying to find [log4j.xml] using 
sun.misc.launcher$appclassloa...@11b86e7 class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader 
sun.misc.launcher$appclassloa...@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 <[email protected]> 
05/26/2010 09:02 AM
Please respond to
"Log4J Users List" <[email protected]>


To
[email protected]
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: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to