This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Relative path is not working for log4j after restarting apache in load balancing  RSS feed

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

we have given relative path in log4j configuration but when we restart apache in our load balancing
server our log generation stops.

please help if any one know about this.

Thanks.
 
Sheriff
Posts: 21747
102
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it stop, or do the logs perhaps end up somewhere you don't know about? If it really stops, perhaps Tomcat doesn't have the rights to write to the location.
 
nitin yeola
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually its generating before restart of apache but we have to restart tomcat to start generation of log again.

whether is it some relative path issue with log4j?
 
Bartender
Posts: 20766
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's better not to use relative paths for web-related resources. The concept of a fixed "working directory" that applies everywhere in the server and apps is not guaranteed. Any component can change its working directory at any time without warning. So absolute paths are much safer.
 
nitin yeola
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

Then I have to change path every time wherever I have to installed my application..
Because I have testsite, localsite, production so need to careful everytime while deploying application.
 
Tim Holloway
Bartender
Posts: 20766
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

nitin yeola wrote:Thanks.

Then I have to change path every time wherever I have to installed my application..
Because I have testsite, localsite, production so need to careful everytime while deploying application.



A WAR that has to be custom-built depending on where it's being deployed isn't "complete". If you do it right (admittedly, it's extra work), the same WAR can be used everywhere. That's my preferred approach, since it saves me from accidentally dropping the wrong WAR on the wrong server AND it ensures that when I test, the WAR is the same WAR that's running in production.

One of the best ways to ensure this portability is to use the Tomcat Context resource definition elements. You set them in each Tomcat server as part of the initial deployment, and in most cases, you leave them there unchanged thereafter. They contain the host-dependent settings such as what security Realm you're using, locations of external workfile directories, locations of log directories, and whatever else may vary from server to server. The values can be retrieved in the webapp using JNDI.
 
Message for you sir! I think it is a tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!