Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Can tomcat write to apache access_log/error_log

Posted on 2014-02-03
5
Medium Priority
?
454 Views
Last Modified: 2014-02-10
Can tomcat write to apache access_log/error_log?
0
Comment
Question by:jmarkfoley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 8

Assisted Solution

by:Surrano
Surrano earned 1200 total points
ID: 39831780
I can interpret this question in several ways;

Q: Is it normal for tomcat (as opposed to its apps) to write to apache logs?
A: No, tomcat has its separate log dir and naming conventions

Q: Is it possible to configure tomcat so that it uses the same log files?
A: Yes but it leads to confusion since both Apache and Tomcat will keep those files continuously open, as opposed to periodically appending messages, i.e. one will overwrite the other and all the messages will be garbled

Q: Is it possible to configure *both* to use the *same* output without corrupting each other?
A: Yes if you use the pipe version to redirect output to a command that can safely cat at the end of a file and flush after every message but that may be a major performance impact. Another possibility is to write into a FIFO which is in turn read and archived by a single process. It will be buffered but safe.

Q: Is it possible that a tomcat application "accidentally" (*ahem*) writes into Apache logs?
A: Yes, if the webapp runs with sufficient permissions to modify the apache log files then it will be able to do that. But I'd consider calling such a webapp a malware.
0
 
LVL 6

Assisted Solution

by:Mahesh Bhutkar
Mahesh Bhutkar earned 300 total points
ID: 39832053
Tomcat has five types of logging that we can configure, such as Application, Server, Console, Access, Host manager.
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 39832853
tomcat seems to be logging to the Apache access_log; the messages are in a tomcat-like format, e.g:

198.234.157.10 - - [04/Feb/2014:10:48:58 -0500] "GET /ohprs/images/slideShow/Blizzard1.jpg HTTP/1.1" 304 -

I'm suspecting tomcat for doing the logging as this does not appear to be the default Apache log format.

I've found that writing to stderr from jsp programs logs to $CATALINA_HOME/logs/catalina.out. That is probably adequate for my needs without going through all the complexity of using JULI or Log4j, but I'd rather log to Apache's access_log or error_log so I only have to examine one file.

Not doable?
0
 
LVL 1

Accepted Solution

by:
jmarkfoley earned 0 total points
ID: 39836012
Writing to $CATALINA_HOME/logs/catalina.out from System.err.println() does what I want. JULI or Log4j is vastly overcomplicated and time consuming for my needs.
0
 
LVL 1

Author Closing Comment

by:jmarkfoley
ID: 39846816
Writing to $CATALINA_HOME/logs/catalina.out from System.err.println() does what I want. JULI or Log4j is vastly overcomplicated and time consuming for my needs.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question