Tomcat Log Java.util.logging.Logger use (iv)

Source: Internet
Author: User

Today, the written code is tested on Ubuntu and a few problems are found.

1: Every time svn update source, after the tomcat redeployment log files will disappear ~ ~

View Source Discovery:

Java.util.logging.FileHandler private void Configure () {Logmanager manager = Logmanager.getlogmanager ();

	String cname = GetClass (). GetName ();
	Pattern = Manager.getstringproperty (CNAME + ". Pattern", "%h/java%u.log");
	Limit = Manager.getintproperty (CNAME + ". Limit", 0);
	if (Limit < 0) {limit = 0;
	Count = Manager.getintproperty (CNAME + ". Count", 1);
	if (count <= 0) {count = 1;
	} append = Manager.getbooleanproperty (CNAME + ". Append", false);
	Setlevel (Manager.getlevelproperty (CNAME + ". Level", Level.all));
	SetFilter (Manager.getfilterproperty (CNAME + ". Filter", null));
	Setformatter (Manager.getformatterproperty (CNAME + ". Formatter", New Xmlformatter ());
	try {setencoding (Manager.getstringproperty (CNAME + ". Encoding", null));
	    The catch (Exception ex) {try {setencoding (null);
		The catch (Exception ex2) {//doing a setencoding with null should always.
	    Assert false; }
	}
    }

Where this line indicates that the log data is not appended by default

   Append = Manager.getbooleanproperty (CNAME + ". Append", false);
So you need to configure it under Logging.properties.
To solve this problem

2: Note that there is such a sentence in the Logger.properties file, which means that basically you cannot configure the custom handler through the configuration file.

These handlers would be installed during VM startup.
# These classes must are on the system classpath.

# "Handlers" specifies a comma separated list of log Handler 
# classes.  These handlers would be installed during VM startup.
# These classes must are on the system classpath.
# By default We only configure a consolehandler, which'll only
# Show messages at the INFO and above levels.
handlers= Java.util.logging.ConsoleHandler, Java.util.logging.FileHandler


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.