Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

open source library always writes log to System.out ?

 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my log4j.properties, I set

log4j.rootCategory=DEBUG,MyFile

log4j.appender.MyFile.File=myLog.log

then I set the appender MyFile's properties, etc.
Things work fine and I see all my application logs in my log file as expected.  But, I found all the open source library logs go to system out file, even I didn't have "stdout" in my log4j.rootCategory.
I do have settings for open source  like

log4j.logger.org.apache.commons=DEBUG

but they all go to system.out file.  None of them in myLog.log file.

Why ?
 
Saloon Keeper
Posts: 13394
296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you know that those libraries are using log4net?
 
Linwood Hayes
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:How do you know that those libraries are using log4net?



good point.  I guess I mistakenly thought if I do "log4j.logger.org.apache.commons=DEBUG" it would set its level to DEBUG.  But actually apache commons probably only uses system out and not using my log4j setting at all.
 
Linwood Hayes
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even I do something like

log4j.logger.org.springframework=ALL, MyFile

It still doesn't go to appender "MyFile".  It only goes to system out.
 
Sheriff
Posts: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post your entire log4j.properties file?  Use code tags, but first pull down the "Java" field and change it to "Text."
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic