in logger: Track,debug,info,warn,error. For each level, there are five log methods, with the info level as an example:
public void info (String msg);
Parameter-free log method, example:Logger.info ("Start initialization of profile reading module");Output2014-08-11 23:36:17,783 [main] INFO C.j.training.logging.service.userservice-Start initialization of profile reading module
public void info (String format, Object Arg);
A
First, direct use:
Output to Output1.txt file in the project folder
//////////////////////////////
Debug-here is some DEBUG
Info-here is some INFO
Warn-here is some WARN
Error-here is some ERROR
Fatal-here is some FATAL
//////////////////////////////
package hunnu.sanha.test;
import org.apache.log4j.Level;
import Org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import Org.apache.log4j.FileAppe
backup files for a specified file
Log4j.appender.my2log.MaxBackupIndex = 1
#org. apache.log4j.PatternLayout specify the log output format
log4j.appender.my2log.layout= Org.apache.log4j.PatternLayout
#ConversionPattern给出具体的打印方式
Log4j.appender.my2log.layout.conversionpattern=%-d{yyyy-mm-dd HH:MM:SS} [%c]-[%p]%m%n
#rootLogger specifies that the logger used has mylog and My2log
#warn Specify the type of print information: info: Debug Info
Package com.v512.log4j;
Import Org.apache.log4j.Logger;
public class Hellolog4j {
//construction logger, the formal parameter is the class where the logger is located, which means that you want to do log
private static Logger Logger = Logger.getlogger in the class ( Hellolog4j.class);
/**
* @param args */public
static void Main (string[] args) {
getMessage ();
}
private static void GetMessage () {
//records the various levels of information, where it is stored, and in what way i
NPM, and we'll look at NPM,
c:\windows\system32>npm-v
5.6.0
NPM installation Vue.js
Command: NPM Install Vue-g
Here, the-G refers to the installation to the global directory.
View version:
c:\windows\system32>vue-v
2.9.3
Suppose I want to create a new project under the App_codes folder in E, then we can use CMD to jump to this directory and execute: Vue init webpack Vue-mui
Next, press ENTER as shown:
Finally, wait a certain time, the results of the operation are as follows:
# Insta
method is used to print some warning messages, suggesting that the program may have potential risks in this place, and it is best to fix these warnings. Corresponds to level warn, one level higher than info.6.5,LOG.E ()This method is used to print error messages in a program, such as a program entering a catch statement. When the error message is printed, it usually means that your program has a serious problem and must be repaired as soon as possibl
information:Log. debug ("111 ");Log.info ("222 ");Log. Warn ("333 ");Log. Error ("444 ");Log. Fatal ("555 ");
The log here is the class member variable defined in the second step above. Its type is Org. apache. commons. logging. log, through the member method of this class, we can output log information of different types to the destination (where is the destination? Depending on the configuration, it may be stdout, a file, an email, or even a text m
: indicates the power level, from 0 to 1.0. When this value is 0, it indicates that the power is exhausted and the system is about to shut down. If the value is 1.0, the battery is fully powered.For these statuses, the interface provides corresponding events, including onchargingchange, onchargingtimechange, ondischargingtimechange, and onlevelchange. The basic usage is simple:
The Code is as follows:
// Obtain the battery object!Var battery = navigator. battery | navigator. webkitBattery | nav
)
MSMQ-based message queue
Windows system logs
For other forms, see http://www.nlog-project.org/targets.html
In addition, each trace message can automatically containContextual Information)And send it to the target that records the tracking information. The context information can contain the following content:
Current date and time (in multiple formats)
Record level
Source Name
Stack information of the method for outputting message Tracing
Environment variable value
Exception details
= getinitparameter ("log4j ";// If the log4j-init-file is not set, then no point in tryingSystem. Out. println ("...... log4j start ";If (file! = NULL ){Propertyconfigurator. Configure (prefix + file );}}Public void doget (httpservletrequest req, httpservletresponse res ){}}This code is very simple, it can be seen that in the loading process, the program will read the/WEB-INF/log4j. properties FileThis file is the focus of this article, that is, the log4j configuration file.
# Set root logger l
checked.*/This. shouldBeLogged = function (inLevel ){
If (inLevel> = this. logLevel ){Return true;} Else {Return false;}
} // End shouldBeLogged ().
/*** This function logs messages at TRACE level.* (Format and display TRACE error level information, and push it accordingly)* @ Param inMessage The message to log.*/This. trace = function (inMessage ){
If (this. shouldBeLogged (this. LEVEL_TRACE) this.tar getDiv ){This.tar getDiv. innerHTML + =""[TRACE]" + inMessage + "}
} // End trace ().
/*** T
This article mainly introduces a encapsulated universal detection form method, which is very easy to use and easy to use. We recommend this method to our friends. Verification of the detection form cannot be empty (. notnull)
Function: When multiple (including one) forms under a pair of form tags need to be submitted, use js to accurately determine the elements of the current button
Usage: Find the container of the current form under the form label and give class = "form", and the submit button
LOG4J consists of three major components: Loggers,appenders and layouts.1. Define the Log component loggerEach logger can have one or more appender, each appender representing the output destination of a log, such as the console or a file.The syntax for configuring root logger is:Log4j.rootlogger=[priority],appendername,appendername,...-The syntax for configuring a custom logger component is:Log4j.logger.loggername=[priority],appendername,appendername,...-Log4j.rootlogger=info,stdout, RThis sent
First, a new log4j.properties file can be created in the classes of the project; In the actual programming, in order to make the log4j really run in the system in advance also to define the configuration file. The defining step is to use the logger, Appender, and layout separately. LOG4J supports two configuration file formats, one in XML format and one in Java properties (key=value) Java attribute file (key = value). (Only the properties file is indicated here) 1. Configure Root Logger Its synt
First, a new log4j.properties file can be created in the classes of the project; In the actual programming, in order to make the log4j really run in the system in advance also to define the configuration file. The defining step is to use the logger, Appender, and layout separately. LOG4J supports two configuration file formats, one in XML format and one in Java properties (key=value) Java attribute file (key = value). (Only the properties file is indicated here) 1. Configure Root Logger Its synt
I. Introduction of LOG4JThe log4j has three main components: loggers (Logger), appenders (output source), and layouts (layout). This can be simply understood as the log category, where the logs are to be exported and how the logs are exported. The combined use of these three components makes it easy to record the type and level of information, and to control the style and location of the log output at run time.1, loggersThe loggers component is divided into five levels in this system: DEBUG, INF
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.