Solved

Can tomcat write to apache access_log/error_log

Posted on 2014-02-03
5
417 Views
Last Modified: 2014-02-10
Can tomcat write to apache access_log/error_log?
0
Comment
Question by:jmarkfoley
  • 3
5 Comments
 
LVL 8

Assisted Solution

by:Surrano
Surrano earned 400 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 100 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need assistance modifying php script 3 40
Service "nameserver" appears to be down 4 526
phpmyadmin installation 3 53
Internal wordpress pages 404 5 40
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

943 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now