• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

log4j.properties in unix

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a log4j.properties file that I have set to print debugging information for a few variables in my code and this works in the windows envrionment but when I uploaded the war file to a unix machine, I do not get the debugging statements. Why the different behavior between the two? Here is a snippet of my file:

log4j.rootLogger=DEBUG, CONSOLE, FILE #log4j.appender.FILE.File=C:/DEV_ENV/logs/myapp.log log4j.appender.FILE.File=/opt/tomcat/logs/myapp.log log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender log4j.appender.FILE.Append=true log4j.appender.FILE.DatePattern = '.'yyy-MM-dd log4j.appender.FILE.layout = org.apache.log4j.PatternLayout log4j.appender.FILE.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j.appender.CONSOLE.layout.ConversionPattern=%d{DATE} [%-15.15t] [%x] %c.%M(%F:%L)%n%p: %m%n # Disable the digester errors for the struts config parsing log4j.logger.org.apache.commons.digester=WARN #log4j.logger.httpclient.wire=OFF log4j.logger.org.apache.commons=WARN log4j.logger.org.apache.catalina=WARN log4j.logger.org.apache.jasper=WARN log4j.logger.org.apache.struts=WARN log4j.logger.org.quartz=WARN

Thanks


 
Ranch Hand
Posts: 623
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, use "[code]" tag for this source file. It's quite unreadable as it is...

And when it comes to your problem - do you have write privileges to '/opt/tomcat/logs/myapp.log' ? Does this file exist?

Cheers!
 
Manon Baratt
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the unreadable code. Yes, the file does exist in the unix box, what is missing is what I see in windows. Here is a line of what I see in windows but not in the unix box:

2011-01-11 13:23:30 SearchAction [DEBUG] manon client id =123444

Thanks again for your help
 
Piotr Nowicki
Ranch Hand
Posts: 623
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So if this file does exist and you have needed permissions to access and edit it, than doesn't the application shows some log4j warnings?

Usually in such cases (no warning message, no logs) I had some problems with multiple log4j JARs in the classpath. Maybe your tomcat server is configured different on your Windows box and Unix? Check the server-level libs for differences.
You can also check the extensions directory (i.e. /usr/lib/jvm/java-6-sun/jre/lib/ext) for possibly conflicting JARs.
Also - no errors in standard output - catalina.out file?

Cheers!
 
Manon Baratt
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much for your reply. I had an error in my log4j.properties. I was using the wrong address for the file in unix. Now that I have fixed it, I have two files. One with a datestamp in the name which still shows the initialize and close webappcontext info and another without datastamp in the name which has the information showing up in windows. I am looking at catalina.out now and trying to see what it shows for my app. Thanks again for your help. I am appreciating how much more there is to know to logging!!!

Cheers!
 
Piotr Nowicki
Ranch Hand
Posts: 623
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm glad something was fixed, Manon :-)

Sorry for the question but I couldn't find an undoubtful answer in your post: is there anything else to fix, or your application logging works fine now?

Cheers!
 
Manon Baratt
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My problem was fixed.

Thanks again for your help.

Cheers!!
Manon
 
Piotr Nowicki
Ranch Hand
Posts: 623
1
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad it worked, Rancher! :-)
 
If you have a bad day in October, have a slice of banana cream pie. And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic