You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "nishant24011998 (via GitHub)" <gi...@apache.org> on 2024/12/18 04:42:56 UTC

[I] Not getting error traces in json format. (logging-log4j2)

nishant24011998 opened a new issue, #3307:
URL: https://github.com/apache/logging-log4j2/issues/3307

   ## Description
   
   We are using log4j 2.17.1 version and along we are using json template attached below. In some cases, we are not getting error traces in json format such as -: 
   
   
   {"time":"XXX","level":"XXX","module":"XXX","class":"XXX","message":"XXXX"}
   Exception in thread "main" java.lang.ExceptionInInitializerError
   	at com.rjil.cloud.drive.repository.SecDBRepository.getInstance(SecDBRepository.java:57)
   	at com.rjil.drive.sio.cons.bootstrap.SIOConsumerBootstrap.populateStorageCache(SIOConsumerBootstrap.java:105)
   	at com.rjil.drive.sio.cons.bootstrap.SIOConsumerBootstrap.preBootstrap(SIOConsumerBootstrap.java:74)
   	at com.rjil.drive.sio.cons.main.SIOConsumerInit.bootstrapRuntime(SIOConsumerInit.java:85)
   	at com.rjil.drive.sio.cons.main.SIOConsumerInit.main(SIOConsumerInit.java:36)
   Caused by: ApplicationRepositoryException (a11db359-aca8-4943-a02b-4759966e596d): 500 Internal Server Error, SQL not found for query id :: sec.headless.schema
   	at com.rjil.cloud.drive.repository.SecDBRepository.<init>(SecDBRepository.java:44)
   	at com.rjil.cloud.drive.repository.SecDBRepository$Singleton.<clinit>(SecDBRepository.java:49)
   	... 5 more
   Caused by: java.util.InvalidPropertiesFormatException: SQL not found for query id :: sec.headless.schema
   	at com.rjil.cloud.drive.repository.QueryLoader.getQuery(QueryLoader.java:107)
   	at com.rjil.cloud.drive.repository.SecDBRepository.<init>(SecDBRepository.java:38)
   	... 6 more
   	
   ----------------------------------------------------------------------------------------------------------------------------------
   	My Log4j is as follow:- 
   	
   	<?xml version="1.0" encoding="UTF-8"?>
   <Configuration status="ERROR">
   	<Properties>
   		<Property name="log-path">/usrdata/logs/applogs</Property>
   		<Property name="json-template-path">/usrdata/apps/appserver/netty/props/</Property>
   		<!--<Property name="json-template-path">/usrdata/GitRepo/enterpriseAdminConsoleUpgrade/Deployment/dev</Property>-->
   	</Properties>
   	<Appenders>
   		<RollingFile name="RollingFile" fileName="XXXXXX" filePattern="XXXXX.gz">
   			<JsonTemplateLayout eventTemplateUri="file://${json-template-path}/JsonTemplate.json"/>
   			<Policies>
   				<SizeBasedTriggeringPolicy size="100 MB" />
   				<TimeBasedTriggeringPolicy interval="3600" modulate="true" />
   			</Policies>
   			<DefaultRolloverStrategy max="20" />
   		</RollingFile>
   		<!--<RollingFile name="RollingFile" fileName="XXX" filePattern="$XXXX">
   			<PatternLayout>
   				<pattern>[%d{dd-MMM-yyyy HH:mm:ss.SSS}] [%-5p] [%X{SEVERITY}] [%X{MICRO_SERVICE_CODE}] [%t] [%X{USER_ID}] [%X{DEVICE_KEY}] [%X{REQUEST_ID}] [%X{HTTP_FORWARDER_DETAILS}] [%X{HTTP_RESPONSE_CODE}] [%X{TEJ_ERROR_CODE}] [%c] %m%n</pattern>
   			</PatternLayout>
   			<Policies>
   				<SizeBasedTriggeringPolicy size="100 MB" />
   				<TimeBasedTriggeringPolicy interval="3600" modulate="true" />
   			</Policies>
   			<DefaultRolloverStrategy max="20" />
   		</RollingFile>-->
   
   		<File name="File" fileName="${log-path}/service-healthCheck.log" append="false">
               <PatternLayout pattern="%m%n" />
           </File>
   		<RollingFile name="BusinessEvent" fileName="${log-path}/business-event.log" filePattern="${log-path}/archives/business-event-%d{MM-dd-yy-HH-mm-ss}-%i.log.gz">
               <PatternLayout>
   				<pattern>[%d{dd-MMM-yyyy HH:mm:ss.SSS}] [%-5p] [%X{SEVERITY}] [%X{MICRO_SERVICE_CODE}] [%t] [%X{USER_ID}] [%X{DEVICE_KEY}] [%X{REQUEST_ID}] [%X{HTTP_FORWARDER_DETAILS}] [%X{HTTP_RESPONSE_CODE}] [%X{TEJ_ERROR_CODE}] [%c] %m%n</pattern>
   			</PatternLayout>
   			<Policies>
   				<SizeBasedTriggeringPolicy size="100 MB" />
   				<TimeBasedTriggeringPolicy interval="3600" modulate="true" />
   			</Policies>
   			<DefaultRolloverStrategy max="20" />
   		</RollingFile>
   		<!--<Console name="BusinessEvent" target="SYSTEM_OUT">
   			<PatternLayout>
   				<pattern>[%d{dd-MMM-yyyy HH:mm:ss.SSS}] [%-5p] [%X{SEVERITY}] [%X{MICRO_SERVICE_CODE}] [%t] [%X{USER_ID}] [%X{DEVICE_KEY}] [%X{REQUEST_ID}] [%X{HTTP_FORWARDER_DETAILS}] [%X{HTTP_RESPONSE_CODE}] [%X{TEJ_ERROR_CODE}] [%c] %m%n</pattern>
   			</PatternLayout>
   	    </Console>-->
   
   	</Appenders>
   	<Loggers>
   		<!-- Cassandra Driver Logs -->
   		<Logger name="com.datastax.driver.core.QueryLogger" level="ERROR" />
          	<Logger name="com.datastax.driver.core.Cluster" level="ERROR" />
           <Logger name="com.datastax.driver.core.Session" level="ERROR" />
           <Logger name="com.datastax.driver.core.RequestHandler" level="ERROR" />
           <Logger name="com.datastax.driver.core.Connection" level="ERROR" />
           <Logger name="com.datastax.driver.core.Message" level="ERROR" />
           
           <!-- Apache HTTP Client and Netty Logs -->
           <Logger name="org.apache.http.wire" level="WARN"/>
   		<Logger name="io.netty.channel" level="WARN"/>
   		<Logger name="io.netty.buffer" level="WARN"/>
   		<Logger name="io.netty.util" level="WARN"/>
   		<Logger name="org.apache.http" level="WARN"/>
   		<Logger name="org.apache.http.impl.conn.DefaultClientConnection" level="WARN"/>
   		
   		<!-- HikariCP Pool Logs -->
   		<Logger name="XXXX" level="WARN"/>
   		<Logger name="XXXX" level="WARN"/>
   		
   		<!-- Turn off other logging -->
   		<Logger name="XXXXX" level="OFF"/>
   		<Logger name="XXXX" level="OFF"/>
   		<Logger name="XXXX" level="OFF"/>
   		<Logger name="XXXX" level="OFF"/>
   		<Logger name="XXXX" level="WARN"/>
   		<Logger name="XXXX" level="WARN"/>
   		<Logger name="XXXX" level="ERROR"/>
   
   		<Logger name="cXXXX" level="INFO" additivity="false">
               <AppenderRef ref="File"/>
            </Logger>
            <Logger name="XXXX" level="INFO" additivity="false">
               <AppenderRef ref="BusinessEvent"/>
           </Logger>
   		<Root level="info" additivity="false">
   			<AppenderRef ref="RollingFile" />
   		</Root>
   	</Loggers>
   ----------------------------------------------------------------------------------------------------------------------------------
   **I have also attached my JsonTemplate.json  as well along with this.**
   
   [JsonTemplate.json](https://github.com/user-attachments/files/18174814/JsonTemplate.json)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Not getting error traces in json format. (logging-log4j2)

Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on issue #3307:
URL: https://github.com/apache/logging-log4j2/issues/3307#issuecomment-2550566344

   @nishant24011998,
    
   > ```
   > Exception in thread "main" java.lang.ExceptionInInitializerError
   >     ...
   > ```
   
   This does not look as the normal stack trace of a log event, but the output of [`Thread.UncaughtExceptionHandler`](https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.UncaughtExceptionHandler.html). Are you sure this in the content of a log file and **not** on `System.err`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Not getting error traces in json format. [logging-log4j2]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #3307:
URL: https://github.com/apache/logging-log4j2/issues/3307#issuecomment-2691842059

   This issue is stale because it has been waiting for your feedback for more than 60 days. The Apache Logging Services community values every submitted issue, but without additional information from you, we are unable to provide a solution to your problem.
   Please comment on this issue or it will be closed in 7 days.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Not getting error traces in json format. [logging-log4j2]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #3307: Not getting error traces in json format.
URL: https://github.com/apache/logging-log4j2/issues/3307


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org