Automatically initialize with servlet when the service is turned on

xiaoxiao2021-03-06  67

Write a servlet:

Package colorling;

Import javax.servlet. *; import javax.servlet.http. *; import java.io. *; import com.soutec.g_log.config;

Public class initlog extends httpservlet {

Public void init () throws servletexception {// log: string path = system.getProperty ("user.dir"); //system.out.println (PATH); config.staticinit (Path File.seParetor "log4j. Properties "); // Initialize the log module

System.out.println ("Initial Log Finish!");}}

Do the initialization work you want to implement in the init () method. In this example, it is the initialization of the log module.

Then add: initlog colorring.initlog 1 Restart the server, you will see that the initialization work has been completed.

转载请注明原文地址:https://www.9cbs.com/read-119907.html

New Post(0)