Solved

Can tomcat write to apache access_log/error_log

Posted on 2014-02-03
5
437 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
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.
Suggested Courses

623 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