Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j file logging problem

 
Andrei Nistor
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Sheriff
Pie
Posts: 20763
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic