• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Weblogic 9.2 + log4j : Adding path to log file not working

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are having a web application using log4j deployed on weblogic 9.2
We are using log4j for application logging. When giving the log file name for the file appender
without the path the log file gets generated in the domain folder of weblogic server

log4j.appender.id2.File=xyz.log

But if I add any path to it the log file doesnt get generated
log4j.appender.id1.File=/xyzlogs/xyz.log
log4j.appender.id1.File=xyzlogs/xyz.log
None of the above combination works.

I even tried manually creating the xyzlogs folder under the doamin folder on weblogic server but still the log file doesnt get generated.

Anybody knows how to handle this ?
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you configure log4j from weblogic admin console?
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So why are you not providing an absolute path ?
 
Viral Shah
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, we have not configured Log4j from the console. The log4j properties file is bundled with the application.

We dont want to provide absolute path as then it will require to be changed based on development, QA or production environment. We dont want to hard code the absolute path as a best practice.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On the contrary it is not a good practice to let log4j decide where to log files based on the relative path. Make sure the same path exists in all environments. Its easier for developers that way
 
Viral Shah
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That may not be possible every time. On development it could be D: where as on QA or production it could be F: or H:
Also sometimes the development is on Windows and QA/Prod are Unix servers.
 
Andy Kay
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can also try moving log4j properties file out of WAR into root of weblogic domain where WAR is deployed. I thought this is a best approach as when ever you do make any changes you dont need re-deploy the WAR but yes you need to bounce the server

To answer you question. I think i also got this issue. Some times when you do'nt mention absolute path, it may create the log files under root drive where domain is running. For eg, if your domain is running under c:\domains\sampleDomain it may create log file under c:\xyzlogs\xyz.log

Check it out and also make sure you have enabled the appender you are refering.

Andy
 
Hey! You're stepping on my hand! Help me tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic