I've several webapps deployed on my Tomcat-installation and I'm using swallowOutput="true" in my context.xml in order to achieve different 'per-webapp'-log-outputs, not just one big catalina.out together for all webapps. That work's fine. Therefore, I'm using a logging.properties-file for each webapp.
The webapps are generating log output by using basic System.out.println.
Now, I would like to define a very simple log-format to be generated by Tomcat by specifying
java.util.logging.SimpleFormatter.format=%5$s %n
However, the generated logs always show the full format which I do not need, whatever/however I specify the format-string above:
22-Jun-2019 16:08:15.310 INFO [http-nio-80-exec-10] org.apache.catalina.core.StandardWrapperValve.invoke backend Sat Jun 22 16:08:15 CEST 2019: ... output of the servlet's System.out.println-calls ...
I would like to generate a small and clearly laid out log without the „StandardWrapperValve“ etc tokens in each line.
My global logging.properties file is this:
# 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.AsyncFileHandler, 2localhost.org.apache.juli.AsyncFileHandler, 3manager.org.apache.juli.AsyncFileHandler, 4host-manager.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
.handlers = 1catalina.org.apache.juli.AsyncFileHandler, java.util.logging.ConsoleHandler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
1catalina.org.apache.juli.AsyncFileHandler.level = FINE
1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.
2localhost.org.apache.juli.AsyncFileHandler.level = FINE
2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.
3manager.org.apache.juli.AsyncFileHandler.level = FINE
3manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.AsyncFileHandler.prefix = manager.
4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
4host-manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = org.apache.juli.SimpleFormatter
java.util.logging.SimpleFormatter.format=%5$s %n
org.apache.juli.SimpleFormatter.format=%5$s %n
############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.AsyncFileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.AsyncFileHandler
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.AsyncFileHandler
# 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
# To see debug messages for HTTP/2 handling, uncomment the following line:
#org.apache.coyote.http2.level = FINE
# To see debug messages for WebSocket handling, uncomment the following line:
#org.apache.tomcat.websocket.level = FINE
And the per-webapp logging.properties file is this:
handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
org.apache.juli.FileHandler.level = FINE
org.apache.juli.FileHandler.directory = ${catalina.base}/logs
org.apache.juli.FileHandler.prefix = webappX.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format=%5$s %n
1catalina.java.util.logging.SimpleFormatter.format=%5$s %n
org.apache.juli.SimpleFormatter.format=%5$s %n
As you can see, I've already tried different lines to set the format-string to different class names, e.g.:
java.util.logging.SimpleFormatter.format1catalina.java.util.logging.SimpleFormatter.formatorg.apache.juli.SimpleFormatter.format
as I've found some information about this on other StackOverflow threads, but none of them shows any effect. The log output format stays the same, always in full format. The format-string does not show any impact.
Thanx for any ideas, Tombo