title: How to diagnose the "Error listenerStart" error during WAR deploy in Tomcat7?
body: <p>When I deploy my war file <code>my-server.war</code> to Tomcat7 (using <code>mvn cargo:deploy</code> or <code>mvn cargo:redeploy</code>), I get the errors <code>Error listenerStart</code> and <code>Context [/my-server] startup failed due to previous errors</code> (see log fragment see below).</p>
  
  <pre><code>Jul 12, 2013 12:52:41 PM org.apache.catalina.startup.HostConfig deployWAR
  INFO: Deploying web application archive /var/lib/tomcat7/webapps/my-server.war
  Jul 12, 2013 12:52:42 PM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Error listenerStart
  Jul 12, 2013 12:52:42 PM org.apache.catalina.core.StandardContext startInternal
  SEVERE: Context [/my-server] startup failed due to previous errors
  Jul 12, 2013 12:53:13 PM org.apache.catalina.session.ManagerBase processExpires
  FINE: Start expire sessions StandardManager at 1373633593504 sessioncount 0
  Jul 12, 2013 12:53:13 PM org.apache.catalina.session.ManagerBase processExpires
  FINE: End expire sessions StandardManager processingTime 1 expired sessions: 0
  Jul 12, 2013 12:53:33 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar
  INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
  Jul 12, 2013 12:54:13 PM org.apache.catalina.session.ManagerBase processExpires
  FINE: Start expire sessions StandardManager at 1373633653518 sessioncount 0
  Jul 12, 2013 12:54:13 PM org.apache.catalina.session.ManagerBase processExpires
  FINE: End expire sessions StandardManager processingTime 21 expired sessions: 0
  </code></pre>
  
  <p>In order to diagnose this error, I want to configure the Tomcat logging so that the stack trace is displayed in the log file.</p>
  
  <p>I changed the <code>log4j.properties</code> and <code>logging.properties</code> as shown below, but I still can't see the stack trace.</p>
  
  <p>What part of which logging configuration file should I change in order for the details of both errors (<code>Error listenerStart</code> and <code>Context [/my-server] startup failed due to previous errors</code>) to be present in the log files?</p>
  
  <p><strong>log4j.properties:</strong></p>
  
  <pre><code>log4j.rootLogger=debug, R 
  log4j.appender.R=org.apache.log4j.RollingFileAppender 
  log4j.appender.R.File=${catalina.home}/logs/tomcat.log 
  log4j.appender.R.MaxFileSize=10MB 
  log4j.appender.R.MaxBackupIndex=10 
  log4j.appender.R.layout=org.apache.log4j.PatternLayout 
  log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n 
  log4j.logger.org.apache.catalina=DEBUG, R
  log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=DEBUG, R
  log4j.logger.org.apache.catalina.core=DEBUG, R
  log4j.logger.org.apache.catalina.session=DEBUG, R
  </code></pre>
  
  <p><strong>logging.properties:</strong></p>
  
  <pre><code># Licensed to the Apache Software Foundation (ASF) under one or more
  # contributor license agreements.  See the NOTICE file distributed with
  # this work for additional information regarding copyright ownership.
  # The ASF licenses this file to You under the Apache License, Version 2.0
  # (the "License"); you may not use this file except in compliance with
  # the License.  You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
  
  .handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
  
  ############################################################
  # Handler specific properties.
  # Describes specific configuration info for Handlers.
  ############################################################
  
  1catalina.org.apache.juli.FileHandler.level = FINE
  1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
  1catalina.org.apache.juli.FileHandler.prefix = catalina.
  
  2localhost.org.apache.juli.FileHandler.level = FINE
  2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
  2localhost.org.apache.juli.FileHandler.prefix = localhost.
  
  3manager.org.apache.juli.FileHandler.level = FINE
  3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
  3manager.org.apache.juli.FileHandler.prefix = manager.
  
  4host-manager.org.apache.juli.FileHandler.level = FINE
  4host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
  4host-manager.org.apache.juli.FileHandler.prefix = host-manager.
  
  java.util.logging.ConsoleHandler.level = FINE
  java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
  
  
  ############################################################
  # Facility specific properties.
  # Provides extra control for each logger.
  ############################################################
  
  org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = DEBUG
  org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler
  
  org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = DEBUG
  org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler
  
  org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
  org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.FileHandler
  
  # For example, set the org.apache.catalina.util.LifecycleBase logger to log
  # each component that extends LifecycleBase changing state:
  #org.apache.catalina.util.LifecycleBase.level = FINE
  
  # To see debug messages in TldLocationsCache, uncomment the following line:
  #org.apache.jasper.compiler.TldLocationsCache.level = FINE
  </code></pre>