log4j2

Get email with execution log even when no error exists

有些话、适合烂在心里 提交于 2020-08-10 19:35:39
问题 My requirements: If there an error is encountered during the execution, I need to send an email having the error log as well as previous logs with log levels >= INFO. My current configuration satisfy this requirement. If there are no errors in the execution, I need the email to have all the messages logged during the execution with log levels >=INFO. Need help here. My current configuration does not satisfy this requirement. I have the following log4j2 xml file in my maven project:

log4j2 - DefaultRolloverStrategy for daily RollingFile appender, max not respected

北战南征 提交于 2020-08-08 07:26:39
问题 I am trying to write an appender with a daily rolling policy with 10 maximum total files no matter the day . Every 10 MB it creates a new log file and stores it with today's date and an index. This is what I have so far: <RollingFile name="MyRollingFile" fileName="./log/logs.log" filePattern="./log/logs-%d{yyyy-MM-dd}-%i.log"> <PatternLayout> <pattern>%n%d{yy-MM-dd HH:mm:ss.SSS} [%p] %m</pattern> </PatternLayout> <Policies> <SizeBasedTriggeringPolicy size="10MB" /> </Policies>

Log4j2 not working in WebLogic 12.2.1

二次信任 提交于 2020-08-03 03:59:50
问题 I am trying to add log4j logging in my web services running under WebLogic 12.2.1 but somehow the logging is not working. This is log4j2.xml in WEB-INF\classes of my WAR file: <?xml version="1.0" encoding="UTF-8"?> <Configuration status="DEBUG"> <Properties> <Property name="log-path">E:/MLM/MyDomain/servers/MyAppSrv01/logs</Property> </Properties> <Appender type="File" name="File" fileName="${log-path}/Services.log" filePattern="${log-path}/Services-%d{yyyy-MM-dd}.log"> <Layout type=

Log4j 2 in Spring Boot: JDBC appender doesn't write log messages to the DB's column

泄露秘密 提交于 2020-07-23 08:20:07
问题 Lately I'm trying to create and configure JDBC log appender, with usage of Log4j 2. The main idea is to send a log every time we hit the particular endpoint (Spring service) and put the Hibernate SQL query from the logs, directly to OPERATION_DESCRIPTION column in GDPR_LOG database table. Here's what I've done so far to achieve it: I excluded in Gradle both 'logback-classic' and 'spring-boot-starter-logging' dependency. I added 'log4j-api', 'log4j-core' and 'spring-boot-starter-log4j2'

Log4j 2 in Spring Boot: JDBC appender doesn't write log messages to the DB's column

孤者浪人 提交于 2020-07-23 08:19:09
问题 Lately I'm trying to create and configure JDBC log appender, with usage of Log4j 2. The main idea is to send a log every time we hit the particular endpoint (Spring service) and put the Hibernate SQL query from the logs, directly to OPERATION_DESCRIPTION column in GDPR_LOG database table. Here's what I've done so far to achieve it: I excluded in Gradle both 'logback-classic' and 'spring-boot-starter-logging' dependency. I added 'log4j-api', 'log4j-core' and 'spring-boot-starter-log4j2'

Log4j 2 in Spring Boot: JDBC appender doesn't write log messages to the DB's column

陌路散爱 提交于 2020-07-23 08:18:28
问题 Lately I'm trying to create and configure JDBC log appender, with usage of Log4j 2. The main idea is to send a log every time we hit the particular endpoint (Spring service) and put the Hibernate SQL query from the logs, directly to OPERATION_DESCRIPTION column in GDPR_LOG database table. Here's what I've done so far to achieve it: I excluded in Gradle both 'logback-classic' and 'spring-boot-starter-logging' dependency. I added 'log4j-api', 'log4j-core' and 'spring-boot-starter-log4j2'

Add trace.id and transaction.id Springboot

若如初见. 提交于 2020-06-29 03:24:25
问题 I have a Springboot micro-service. For logging I'm using Elastic common scheme, implemented using ecs-logging-java. I want to set the trace.ID and a transaction.ID but I'm not sure how? Bonus question, I'm I right in thinking trace.ID should be the ID to following the request through multiple system. transaction.ID is just for within the service? 回答1: Configure your logging patter as below <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} %thread [%X{trace-id}] [%-5level] %class{0} - %msg%n </pattern>