Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 705899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:06:20+00:00 2026-05-14T04:06:20+00:00

I’ve read several questions here concerning Tomcat and logging but I still really don’t

  • 0

I’ve read several questions here concerning Tomcat and logging but I still really don’t understand the “bigger picture”, hence my question:

How and where are my Webapps supposed to do their logging?

By default on my setup Tomcat 6.0.20 logs go in the following file/appender:

./apache-tomcat-6.0.20/logs/catalina.out

Am I suppose to have my webapps also log to this file/appender?

Let say my case is trivially simple and I’ve got just one servlet:

import ... // What do I import here in order to be able to log?

public class SOServlet extends HttpServlet {

    public void doGet(
        final HttpServletRequest request,
        final HttpServletResponse response
    ) throws IOException, ServletException {
    ... // I want to log here, what do I write?

What are the gotchas knowing that there are more than one webapp running on the same Tomcat? (apparently from reading the various questions there are many gotchas).

What about the .war, do I need to put log4j/sl4f/commons-logging/whatever in my .war?

For example I’ve read that, and I’m way more confused than before:

http://tomcat.apache.org/tomcat-6.0-doc/logging.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:06:21+00:00Added an answer on May 14, 2026 at 4:06 am

    How and where are my Webapps supposed to do their logging?

    It depends. You can either make use of ServletContext#log() (which in turn is available in servlets by the inherited getServletContext() method) to log it into the same logfile as the servletcontainer itself, or to go for a separate logger/logfile with help of under each slf4j and/or logback/log4j. The common practice is to give each webapp its own logger so that you have more freedom and control in logging.

    For the case you’re interested, here is a Tomcat wiki with regard to the subject.

    What are the gotchas knowing that there are more than one webapp running on the same Tomcat? (apparently from reading the various questions there are many gotchas).

    If this is with regard to logging: you’ll end up with poor overview in the logfile and less freedom and control in logging the individual webapps.

    What about the .war, do I need to put log4j/sl4f/commons-logging/whatever in my .war?

    Regardless of the library used: If it is specific to the webapp, put it in the WAR. If it is common to all webapps, put it in appserver’s common lib. If it is specific to the appserver, put it in the appserver’s lib.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.