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

  • SEARCH
  • Home
  • 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 8120681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:13:25+00:00 2026-06-06T05:13:25+00:00

I have a web application running in a vanilla install of Tomcat 7 on

  • 0

I have a web application running in a vanilla install of Tomcat 7 on Windows with the internal Tomcat logging left unchanged (default). In my application I use log4j which has a RollingFileAppender writing to my own application log (app.log) in the TOMCAT/logs directory (not the localhost.yyyy-mm-dd.log). Logging seems to work fine for my application except that some stack traces do not show up in app.log and instead show up in the localhost.yyyy-mm-dd.log. For example, my application was missing commons-validators classes and this stack trace did not show in app.log.

I’m not sure how to get these stack traces to show up in my app.log? My log4j.properties file is here:

### Root Level ###
log4j.rootLogger=WARN, LOGFILE

### Application Level ###
log4j.logger.com.ccn=TRACE

### Spring ###
log4j.logger.org.springframework.core=INFO
log4j.logger.org.springframework.beans=INFO
log4j.logger.org.springframework.context=INFO
log4j.logger.org.springframework.web=INFO

### Configuration for the LOGFILE appender ###
log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
log4j.appender.LOGFILE.MaxFileSize=5MB
log4j.appender.LOGFILE.MaxBackupIndex=10
log4j.appender.LOGFILE.File=$\{catalina.home\}/logs/app.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=[%p %d %t]  %c  [%C{1}.%M(): "%m"]%n
  • 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-06-06T05:13:27+00:00Added an answer on June 6, 2026 at 5:13 am

    I found the problem. I’m using a org.springframework.stereotype.Controller annotation to mark my controller class. The specific exceptions that I was losing were being generated in this class. The solution was to add a @ExceptionHandler annotation to a method in the class in which I could redirect the exception to Log4j similar to this:

    @ExceptionHandler
    public void handleException(Exception e) {
        logger.error("Error: ", e);
    }
    

    Without the @ExceptionHandler decorated method the stack traces were being spit out to stderr which ended up in the localhost.yyyy-mm-dd.log.

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

Sidebar

Related Questions

I have a web application running under Tomcat. Logging for various features is implemented
I have a web application running on Windows IIS. This app has a database
I have an extremely simple web application running in Tomcat using Spring 3.0.2, Hibernate
I have a web application running on Tomcat. There are several calculations that need
I have a web application running in tomcat where I'm using a ThreadPool (Java
I have a web application running in a GlassFish 3.1 service on Windows 7
I have a web application running in Tomcat 7. When I place the tomcat
I have a web application running on tomcat at port 8080. The application needs
I have a Java web application running on Tomcat. I want to load static
We have a web application running on Tomcat 7 and it loads a JNI

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.