aspose file tools*
The moose likes BEA/Weblogic and the fly likes Weblogic 9.2 + log4j : Adding path to log file not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Weblogic 9.2 + log4j : Adding path to log file not working" Watch "Weblogic 9.2 + log4j : Adding path to log file not working" New topic
Author

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

Viral Shah
Greenhorn

Joined: Jul 14, 2009
Posts: 8
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 ?
Andy Kay
Greenhorn

Joined: Oct 26, 2009
Posts: 29
Did you configure log4j from weblogic admin console?


http://ananthkannan.blogspot.com
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

So why are you not providing an absolute path ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Viral Shah
Greenhorn

Joined: Jul 14, 2009
Posts: 8
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

Joined: Feb 24, 2006
Posts: 6661
    
    5

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

Joined: Jul 14, 2009
Posts: 8
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

Joined: Oct 26, 2009
Posts: 29
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
 
Don't get me started about those stupid light bulbs.
 
subject: Weblogic 9.2 + log4j : Adding path to log file not working