Bug 61232 - Disabling rotation on the FileHandler creates 'catalina..log' instead of 'catalina.log'
Summary: Disabling rotation on the FileHandler creates 'catalina..log' instead of 'cat...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: JULI (show other bugs)
Version: 8.5.x-trunk
Hardware: PC Linux
: P2 trivial (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
URL:
Keywords: Beginner
Depends on:
Blocks:
 
Reported: 2017-06-28 18:06 UTC by Coty Sutherland
Modified: 2017-07-12 10:30 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Coty Sutherland 2017-06-28 18:06:48 UTC
This is a trivial thing, but I thought it a good Beginner issue (unless someone thinks that this is expected behavior).

When you disable rotatable in the default logging.properties tomcat creates 'catalina..log' rather than the correct 'catalina.log' file. There is no functional issue, but it seems kinda buggy to do that. You can easily workaround it by overriding the default suffix with "1catalina.org.apache.juli.AsyncFileHandler.suffix=log".

To reproduce:

1) Install tomcat
2) Disable log rotation

$ echo "1catalina.org.apache.juli.AsyncFileHandler.rotatable = false" >> conf/logging.properties

3) Start tomcat

bin/startup.sh

4) Check the logs directory for catalina log with double '.'s:

$ ll logs/catalina.*log
-rw-r-----. 1 coty coty 7796 Jun 28 13:58 logs/catalina..log
Comment 1 Coty Sutherland 2017-06-28 18:09:08 UTC
Looking at the o.a.juli.FileHandler class, one option would be to check the rotatable variable inside of configure() and adjust the suffix accordingly so that it doesn't add a '.' if rotatable is off (the prefix ends in '.' so unless it's non-default, which you could also check, it should have the necessary separator).
Comment 2 Violeta Georgieva 2017-07-11 19:18:10 UTC
PR https://github.com/apache/tomcat/pull/69
Comment 3 Violeta Georgieva 2017-07-12 10:30:32 UTC
PR #69 provided by Katya Stoycheva is applied to:

- trunk for 9.0.0.M24 onwards
- 8.5.x for 8.5.18 onwards
- 8.0.x for 8.0.46 onwards
- 7.0.x for 7.0.80 onwards

Regards,
Violeta