In dynamic web application i'm unable to log messages with custom levels.
- i'm building a Java Dynamic Web project with (java8), wildfly11 server with log4j2 (version 2.12.1) logger for logging.
- in log4j2.xml i have created 3 custom levels.
- In java code i'm writing some custom logs but those are not even displayed in console and not even written in specified log file.
- log4j2.xml file is attached for reference.
- when i deploy the web project getting following error.
Could not index class META-INF/versions/9/module-info.class at /D:/JBOSS Server/wildfly-11.0.0.Final/standalone/deployments/asset-services.war/WEB-INF/lib/log4j-api-2.12.1.jar: java.lang.IllegalStateException: Unknown tag! pos=4 poolCount = 33 at org.jboss.jandex.Indexer.processConstantPool(Indexer.java:1417) at org.jboss.jandex.Indexer.index(Indexer.java:1451)
CODE:
<Configuration status="WARN">
<CustomLevels>
<CustomLevel name="AUDIT_INFO" intLevel="1" />
<CustomLevel name="AUDIT_SUCCESS" intLevel="2" />
<CustomLevel name="AUDIT_FALURE" intLevel="3" />
</CustomLevels>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d [%t] %-5level %logger{36} - %msg%n"/>
</Console>
<RollingFile name="AuditLog" fileName="..\\standalone\\log\\ASSETAudit.log" filePattern="..\\standalone\\log\\ASSETAudit-%d-%i{yyyy-MM-dd}.log" ignoreExceptions="false" immediateFlush="true">
<Jsonlayout complete="true" compact ="true" eventEol="true" objectMessageAsJsonObject="false" includeStacktrace="false">
</Jsonlayout>
<Policies>
<OnStartupTriggeringPolicy/>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
</Policies>
</RollingFile>
<RollingFile name="TransactionLog" fileName="..\\standalone\\log\\ASSET.log" filePattern="..\\standalone\\log\\ASSET-%d-%i{yyyy-MM-dd}.log.gz" ignoreExceptions="false" immediateFlush="true">
<PatternLayout pattern="%d [%t] %-5level %logger{36} - %msg%n" />
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true"/>
<SizeBasedTriggeringPolicy size="250MB"/>
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="Console"/>
<AppenderRef ref="TransactionLog" level="INFO" />
<AppenderRef ref="AuditLog" level="AUDIT_FALURE" />
</Root>
</Loggers>
</Configuration>
audit logs with custom level audit_info,audit_success,audit_failure. should be written to assetaudit.log file