tomcat log thing

When tomcat starts, it uses the java.util.logger log framework

tomcat implementation class

package org.apache.juli.logging;

import java.util.logging.ConsoleHandler;
import java.util.logging.Formatter;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Hardcoded java.util.logging commons-logging implementation.
 */
class DirectJDKLog implements Log {




The following defines a log object in the startup class



package org.apache.catalina.startup;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.apache.catalina.Globals;
import org.apache.catalina.security.SecurityClassLoad;
import org.apache.catalina.startup.ClassLoaderFactory.Repository;
import org.apache.catalina.startup.ClassLoaderFactory.RepositoryType;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;


/**
 * Bootstrap loader for Catalina.  This application constructs a class loader
 * for use in loading the Catalina internal classes (by accumulating all of the
 * JAR files found in the "server" directory under "catalina.home"), and
 * starts the regular execution of the container.  The purpose of this
 * roundabout approach is to keep the Catalina internal classes (and any
 * other classes they depend on, such as an XML parser) out of the system
 * class path and therefore not visible to application level classes.
 *
 * @author Craig R. McClanahan
 * @author Remy Maucherat
 */
public final class Bootstrap {

    private static final Log log = LogFactory.getLog(Bootstrap.class);



In the main function we print a debug log

/**
     * Main method and entry point when starting Tomcat via the provided
     * scripts.
     *
     * @param args Command line arguments to be processed
     */
    public static void main(String args[]) {
        String javaVersion = System.getProperty("java.version");
        log.debug("starting ..."+javaVersion);



The log cannot be typed out.
Why ?
How to make this log print out?
The first modification to the log level
of still not printed out.
Why?
Therefore, tomcat is not started at this moment, and the default log file read is still the file java_home/jar/lig/logger.properties. After
modifying the log level of this file, the log prints normally.

Careful friends may notice, why does tomcat print a red log?
because

   /**
     * Create a ConsoleHandler for System.err.
     *
     * The ConsoleHandler is configured based on
     * LogManager properties (or their default values).
     *
     */
    public ConsoleHandler() {
        sealed = false;
        configure();
        setOutputStream(System.err);
        sealed = true;
    }



System.err is the

end ... The

tomcat log starts here, welcome to continue to pay attention
Follow the madman to learn computer from 0, start here...
https://github.com/sparrowzoo

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326373597&siteId=291194637