• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Where should I keep my application's log files

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will be hosting a web application for a NPO on a third party hosting provider. I have to log some exceptions and some informational messages for asynchronous processing. Since the logging requirements are quite simple, I decided to go ahead with the java logging api. Now I am unsure as to where the log files should reside. I can't put them in my application's jar, since they will be erased when I redeploy my application for some reason (and some other reasons also). I don't think the hosting provider will provide access to any other real file path on his server. Can anyone provide me with some insight as to where the log files should normally be placed.

regards,
Nirvan.
 
Marshal
Posts: 27287
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As you correctly observe, putting log files inside directories which belong to your web application is a bad idea. So as you have already figured out, you should store them somewhere else.

There really isn't much more to be said. "Somewhere else" gives you plenty of places to choose from. However if there are restrictions on your choice which are imposed by a third party... you can't really expect us to make suggestions, because we know nothing about those restrictions. If it were me I would just ask that third party for the suggestions.
 
B Nirvan
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul,
Perhaps I should I consulted the hosting provider before posting the question. Anyway, now that I am sure that log files shouldn't be placed in application jar, I have a fair idea what to negotiate. Thanks for the advice,

regards,
Nirvan.
 
Saloon Keeper
Posts: 25837
184
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, you shouldn't write anything into the webapp itself. For a strict J2EE implementation, that would require cracking open the WAR file and updating it. Even when dealing with "exploded" WARs, there are problems, as you have so astutely observed.

Windows has no standard place to put logs. You're on your own there.

In Linux, there are coventional locations:

/var/log is used to hold log files (and directories) for system applications

/var/lib/appname is common usage for applications with a lot of infrastructure.

/opt is also common for third-party apps. I've been known to use things like "/opt/com/mousetech/appname", for example.

/usr/local/appname is a legacy base. My Tomcat logs, for example, are in /usr/local/tomcat6/logs/catalina.out, etc. This is not recommended, however, since properly speaking, /usr/local should be read-only these days. Some configurations put the /usr/local/tomcat6/logs as a softlink to someplace like /var/lib/tomcat6/logs

/srv is a relatively new location for server stuff.

On the whole, /var is the best root for logfiles, since it's the conventional place to put things that grow. Where exactly under /var you put things is subject to debate. My own practice would generally be /var/lib/mywebapp/logs, but YMMV.

It is in the best interest of your hosting provider to agree on somewhere, however!
 
B Nirvan
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim,
Thanks for the explanation. The hosting provider will be hosting glassfish server on windows, so I guess we will have to mutually decide on the best place for the logs.

regards,
Nirvan.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic