项目作者: sandysanthosh

项目描述 :
Java Logging
高级语言:
项目地址: git://github.com/sandysanthosh/LOG4J-java.git
创建时间: 2017-09-24T16:37:57Z
项目社区:https://github.com/sandysanthosh/LOG4J-java

开源协议:

下载


There are several ways to check production logging in a Spring Boot application, some of which include:

  • Using a logging framework such as Logback or Log4j: These frameworks can be configured to write log statements to a file or send them to a remote logging service such as Loggly or Elasticsearch.

  • Using Spring Boot Actuator: Spring Boot Actuator provides a set of endpoints that can be used to monitor and manage a Spring Boot application. One of these endpoints, /actuator/logfile, can be used to view the contents of the application’s log file.

  • Using a log management tool: Tools such as the Elastic Stack, Logstash, and Fluentd can be used to collect, process, and analyze log data from a Spring Boot application.

  • You can also set up the logging level to ERROR,WARN,INFO,DEBUG,TRACE to check the logging in production.

  • You may also want to look into using the Spring Cloud Sleuth for distributed tracing, which allows you to trace the flow of a request through a system of microservices.

LOG4J-java

  1. -logging API for java.

Advantage:

  1. Quick Debugging
  2. Problem Diagnosis -> production
  3. Easy Maintenance
  4. Cost and Time Savings

log level:

  1. import org.apache.log4j.*;
  2. private static org.apache.log4j.Logger log = Logger.getLogger(LogClass.class);
  3. ALL < TRACE < DEBUG < INFO < WARN < ERROR < FATAL < OFF
  4. fatal
  5. error
  6. warn
  7. info
  8. debug

search for error-> direction->up`

LOG4J:

  1. logger.info
  2. logger.fatal
  3. logger.debug
  4. logger.notify
  5. logger.notifyall
  6. logger.error
  7. logger.equals
  8. logger.tostring

POM.xml:

  1. <dependency>
  2. <groupId>org.apache.logging.log4j</groupId>
  3. <artifactId>log4j-core</artifactId>
  4. <version>2.12.1</version>
  5. </dependency>