You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by fmarchioni <f....@pride.it> on 2010/05/26 15:02:30 UTC

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


Re: Logging some packages to File

Posted by Jacob Kjome <ho...@visi.com>.
You're right.  I missed that one, though I did see your other email shortly 
after I sent mine.  Your answer is spot on and the user should start with your 
suggestions before considering my email.

Jake

On Wed, 26 May 2010 14:54:09 -0400
  Douglas E Wegscheid <Do...@whirlpool.com> wrote:
> even if this configuration gets picked up, it won't create the file. No 
> appenders are referenced anywhere.
> 
> 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."
> 
> 
> 
> 
> 
> "Jacob Kjome" <ho...@visi.com> 
> 05/26/2010 02:19 PM
> Please respond to
> "Log4J Users List" <lo...@logging.apache.org>
> 
> 
> To
> "Log4J Users List" <lo...@logging.apache.org>
> cc
> 
> Subject
> Re: Logging some packages to File
> 
> 
> 
> 
> 
> 
>First, I would set "log4j.rootCategory" to "INFO" or "WARN" and lower the 
> threshold as needed for the stuff you are interested in (which you have 
> done, 
> but was unnecessary as long as you set the root category/logger to 
> "DEBUG").
> 
> If you are not seeing the log file get created, then your properties file 
> is 
> probably not getting picked up.
> 
> Note that if "log4j.xml" is found on the classpath, it will be used in 
> preference to "log4j.properties".  Also, it depends where your log4j.jar 
> is 
> located.  If log4j.jar exists in the server classpath, it will never see 
> your 
> config file in WEB-INF/classes.  Besides, if log4j is used at the server 
> level, the server (and all apps in it) will use the same logger repository 
> 
> (unless you install a repository selector, which is another conversation), 
> 
> resulting in configuration being performed exactly once at server startup, 
> not 
> application startup.
> 
> What I suggest is setting the following system property, which will print 
> information to the console showing you which config file is being 
> loaded....
> 
> -Dlog4j.debug=true
> 
> 
> Once you have determined that, you will be able to take corrective action.
> 
> Jake
> 
> On Wed, 26 May 2010 06:02:30 -0700 (PDT)
>  fmarchioni <f....@pride.it> wrote:
>> 
>> 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
> 
> 


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


Re: Logging some packages to File

Posted by Douglas E Wegscheid <Do...@whirlpool.com>.
even if this configuration gets picked up, it won't create the file. No 
appenders are referenced anywhere.

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."





"Jacob Kjome" <ho...@visi.com> 
05/26/2010 02:19 PM
Please respond to
"Log4J Users List" <lo...@logging.apache.org>


To
"Log4J Users List" <lo...@logging.apache.org>
cc

Subject
Re: Logging some packages to File






First, I would set "log4j.rootCategory" to "INFO" or "WARN" and lower the 
threshold as needed for the stuff you are interested in (which you have 
done, 
but was unnecessary as long as you set the root category/logger to 
"DEBUG").

If you are not seeing the log file get created, then your properties file 
is 
probably not getting picked up.

Note that if "log4j.xml" is found on the classpath, it will be used in 
preference to "log4j.properties".  Also, it depends where your log4j.jar 
is 
located.  If log4j.jar exists in the server classpath, it will never see 
your 
config file in WEB-INF/classes.  Besides, if log4j is used at the server 
level, the server (and all apps in it) will use the same logger repository 

(unless you install a repository selector, which is another conversation), 

resulting in configuration being performed exactly once at server startup, 
not 
application startup.

What I suggest is setting the following system property, which will print 
information to the console showing you which config file is being 
loaded....

-Dlog4j.debug=true


Once you have determined that, you will be able to take corrective action.

Jake

On Wed, 26 May 2010 06:02:30 -0700 (PDT)
  fmarchioni <f....@pride.it> wrote:
> 
> 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



Re: Logging some packages to File

Posted by Jacob Kjome <ho...@visi.com>.
First, I would set "log4j.rootCategory" to "INFO" or "WARN" and lower the 
threshold as needed for the stuff you are interested in (which you have done, 
but was unnecessary as long as you set the root category/logger to "DEBUG").

If you are not seeing the log file get created, then your properties file is 
probably not getting picked up.

Note that if "log4j.xml" is found on the classpath, it will be used in 
preference to "log4j.properties".  Also, it depends where your log4j.jar is 
located.  If log4j.jar exists in the server classpath, it will never see your 
config file in WEB-INF/classes.  Besides, if log4j is used at the server 
level, the server (and all apps in it) will use the same logger repository 
(unless you install a repository selector, which is another conversation), 
resulting in configuration being performed exactly once at server startup, not 
application startup.

What I suggest is setting the following system property, which will print 
information to the console showing you which config file is being loaded....

-Dlog4j.debug=true


Once you have determined that, you will be able to take corrective action.

Jake

On Wed, 26 May 2010 06:02:30 -0700 (PDT)
  fmarchioni <f....@pride.it> wrote:
> 
> 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


Re: Logging some packages to File

Posted by Jacob Kjome <ho...@visi.com>.
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....@pride.it> 
> 05/27/2010 09:10 AM
> Please respond to
> "Log4J Users List" <lo...@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....@pride.it> 
>> 05/26/2010 09:02 AM
>> Please respond to
>> "Log4J Users List" <lo...@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


Re: Logging some packages to File

Posted by Douglas E Wegscheid <Do...@whirlpool.com>.
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....@pride.it> 
05/27/2010 09:10 AM
Please respond to
"Log4J Users List" <lo...@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....@pride.it> 
> 05/26/2010 09:02 AM
> Please respond to
> "Log4J Users List" <lo...@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
> 
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Logging-some-packages-to-File-tp28680496p28693694.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



Re: Logging some packages to File

Posted by fmarchioni <f....@pride.it>.
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....@pride.it> 
> 05/26/2010 09:02 AM
> Please respond to
> "Log4J Users List" <lo...@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
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Logging-some-packages-to-File-tp28680496p28693694.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


Re: Logging some packages to File

Posted by Douglas E Wegscheid <Do...@whirlpool.com>.
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....@pride.it> 
05/26/2010 09:02 AM
Please respond to
"Log4J Users List" <lo...@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