Handling of exceptions1. For exception handling, one can directly handleThe second can be thrown ,Exception/io,sql, two large classes, compiled and run-time,And the way to handle it: You can use your own defined method, or the system's1-2. The way you define yourself is: Class Mye extends Exception (String msg) {Super (MSG);}When used, it is the IF (a>0) {throw new Mye ("A cannot be greater than 0, please check");}——————————————————————————————————————————1-2 the system is: Try{}catch () {}_____
. Sequence Flow:Sequenceinputstream can concatenate multiple bytes of input streams, and then stream those bytes into one read data.4. Object input and output stream:ObjectInputStreamObjectoutputsreamUse note points:1. Want to read or write objects to disk through the object stream, you need to make the object's owning class implement serializable interface, serializable interface, there is no way to just make a mark2. When changing the value of a property in a class, you can still read the data
1. Background
As one of Apache's open-source projects, slf4j is short for simple logging system for Java. It is a facacde that makes it easy to use various log systems using slf4j? In fact, it is a bit like a container in a broad sense. The design mode includes facade, which is usually translated into the appearance mode ). Slf4j is easy to use.
2. Download The slf4j API
Download through this link:
Ht
Tags: logstash slowlog In the output of Logstash, each line is preceded by a timestamp Therefore, for the Mysqlslowlog and Javalog multi-line output format, it seems superfluous; Logstash provides multiline functionality filter{# start a new line if it starts with #time if[type]== ' Slowlog ' {
multiline{what=>next pattern=> "^#time:" # Merge to Previous line if #[a-za-z0-9_-][emailprotected] begins } multiline{what=>previous negate=>true pattern=> "^#[a-za-z0-9_-][emailprotected]" } }
solution is to introduce jcl-over-slf4j-1.6.1.jar in the project, so that commons-logging can be connected to slf4j, and then unified log output through logback.
2. After the switchover is complete, the error "Java. Lang. illegalaccesserror: tried to access field org. slf4j. impl. staticloggerbinder. Singleton from class org. slf4j. loggerfactory" will occur when the project is started.
The reason is t
1. Overview
Currently, log4j has three development branches: one is the stable version of 1.2, the other is the 1.3 version that has stopped development, and the other is the 2.0 version in the experimental phase. According to the Apache log4j official website, on a computer containing an AMD duron CPU running at MHz and using JDK 1.3.1, log4j 1.2 can complete a log statement in 5 nanoseconds as the log out
1. The Docker container and the system time are inconsistent because the Docker container has a native time zone of 0 time zones, while the domestic system is in the East eight zone.2. There is also a eight-hour time difference between the log time played by the Java application running in the container and the standard time of the container obtained through the Date-r method.That is, the container time is
analysis such as the following GC logs:[GC [psyounggen:9216k->1024k (9216K)] 1246196k->1246220k (1287040K), 0.2398360 secs] [times:user=0.29 sys=0.01, real=0.24 secs][Full GC [psyounggen:1024k->0k (9216K)] [paroldgen:1245196k->1245509k (1492992K)] 1246220k->1245509k ( 1502208K) [pspermgen:2402k->2402k (21248K)], 11.7459250 secs] [times:user=19.42 sys=0.03, real=11.75 secs]
The GC and full GC at the beginning of the log indicate the type of pause
Analyze the following GC logs:[GC [psyounggen:9216k->1024k (9216K)] 1246196k->1246220k (1287040K), 0.2398360 secs] [times:user=0.29 sys=0.01, real=0.24 secs][Full GC [psyounggen:1024k->0k (9216K)] [paroldgen:1245196k->1245509k (1492992K)] 1246220k->1245509k ( 1502208K) [pspermgen:2402k->2402k (21248K)], 11.7459250 secs] [times:user=19.42 sys=0.03, real=11.75 secs]
The GC and full GC at the beginning of the log indicate the type of pause for garb
analyze the following GC logs:[GC [psyounggen:9216k->1024k (9216K)] 1246196k->1246220k (1287040K), 0.2398360 secs] [times:user=0.29 sys=0.01, real=0.24 secs][Full GC [psyounggen:1024k->0k (9216K)] [paroldgen:1245196k->1245509k (1492992K)] 1246220k->1245509k ( 1502208K) [pspermgen:2402k->2402k (21248K)], 11.7459250 secs] [times:user=19.42 sys=0.03, real=11.75 secs]
The GC and full GC at the beginning of the log indicate the type of pause for garb
log4j package, and then build a Java file Testlog4j.java under the package, the code is as follows:
Package log4j;
Import Org.apache.log4j.Logger;
public class Testlog4j {public void log4j () {Logger Log=logger.getlogger (This.getclass (). GetName ());System.out.println ("Test log4j");Log.fatal ("testlog4j + Bonze");}public static void Main (string[] args) {testlog4j tl=new testlog4j ();Tl.log4j ();}}
Run,
=org.apache.log4j.consoleappender (indicates the display method of the A1, with several values below)Org.apache.log4j.ConsoleAppender (console)Org.apache.log4j.FileAppender (file)Org.apache.log4j.DailyRollingFileAppender (Generate a log file every day)Org.apache.log4j.RollingFileAppender (a new file is generated when the file size reaches a specified size)Org.apache.log4j.WriterAppender (send log informatio
same method to compare the remaining elements one by one. It can be seen that if there are n elements, then a total of N-1 wheel comparison, the first m-wheel to be n-m times comparison. (if 6 elements, to make 6-1 round comparison, the first round compared 6-1 times, the third round compared 6-3 times). 7) Select sort (Selection sort): Basic idea: Select an index position of the element, and then compare with the following elements, if greater than the swap position, after the first round of
constants are greater than int's representation range, the compiler will parse the error and need to convert the L to a long type. 3) The automatic conversion order of numeric types is the process of small precision (range of values) to large precision: int–> long–> float–> Double, byte-, short. 4) In an operation expression, all char, short, and byte are automatically converted to the int type, and the final type of the expression equals the type of the data with the highest precision in the c
interface of the object being proxied1 Public Interface Iscoreservice {2 Public void Addscore (String s,string s1); 3 }Implementation of the object being proxied1 Public classScoreserviceimplImplementsiscoreservice{2 intScore = 0;3 PublicListNewArraylist();4 5 Public voidAddscore (String s,string s1) {6System.out.println (score+=3);7 Slist.add (score);8 }9}proxy class1 Public classLoghandlerImplementsInvocationhandler {2 3 PrivateObject TargetObject;4 5
The original Nginx date data is: [28/nov/2014:11:56:09 +0800]need to replace []:timelocal = Timelocal.replace ("[", "" "); timelocal = Timelocal.replace ("] "," ");The following formats require a few points to note:(1) must be 3 m(2) +0800 represents the time zone information, with Z can be resolved(3) must be Locale.english, if written Chinese will errorSimpleDateFormat formatter = new SimpleDateFormat ("Dd/mmm/yyyy:hh:mm:ss Z", locale.english);D ate Date = Formatter.parse (timelocal); SimpleDa
Docker runs ACTIVEMQ, log time and container time as follows:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/77/F4/wKioL1ZyPt-S8Yg9AAMaJK5fMJk997.png "title=" amq_ Time.png "alt=" Wkiol1zypt-s8yg9aamajk5fmjk997.png "/>d me to execute the date command a few minutes, from time to find the exact difference of 8 hours, suspected or time zone reasons.2. DoubtsA friend said that the host's/etc/locatime mounted in the container will resolve
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.