aspose file tools
The moose likes Websphere and the fly likes log4j file logging problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "log4j file logging problem" Watch "log4j file logging problem" New topic
Author

log4j file logging problem

Andrei Nistor
Greenhorn

Joined: Aug 31, 2006
Posts: 9
Hello,

I want to specify a path to put my logs.
I use winXPprof, eclipse 3.2, jdk1.6, log4j-1.2.14

The following is the log4j.properties

////////////////////////////////////////

log4j.rootLogger=trace, stdout, R

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %-5p %C{1}.%M - %m%n

log4j.appender.R=org.apache.log4j.RollingFileAppender
#log4j.appender.R.File=.\\logs\\qt.log
log4j.appender.R.File=logs/qt.log
log4j.appender.R.MaxFileSize= 10000KB # Keep one backup file
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d %-5p %C{1}.%M - %m%n

/////////////////////////////////////

Problem is i cannot find where it logs my application. I use a swing application.


Live long and prosper!
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19680
    
  10

"Andrei N.", welcome to JavaRanch.

We're a friendly group here, but we do require members to have valid display names.

Display names include your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names will be deleted.
Hanumanth Kanthi
Ranch Hand

Joined: May 27, 2004
Posts: 74
I see that your appender's "File" is set to "logs/qt.log" so I would guess that it will attempt to write to that file. and the "logs" directory is expect to be under the current working directory at the time when you started you application, or user home directory if you started the app from windows desktop/menu.

Also, if the logs directory does not exist (in either place) then you might get no log file. Try setting that value to c:\\qt.log and see if it gets created.

Cheers,
H. Kanthi
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: log4j file logging problem
 
It's not a secret anymore!