When log4j prints a log, a number will be printed in front of it, as shown in the figure.

clipboard.png

log4j.properties is configured as follows

-sharp Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1

-sharp A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

-sharp A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%r %d{yyyy-MM-dd HH\:mm\:ss} %c %p -%m%n

two questions

  1. Why is there an extra number in front of it? Sometimes it"s 1, sometimes it"s 2?
  2. Why is the log printed twice?
Sep.25,2021

% r: output the number of milliseconds it took since the application was started to output the log information

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36635-2c007.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36635-2c007.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?