-
1. Re: How to prevent application logs getting logged in server.log in Wildfly 8.2.0 Final AS
jaikiran Aug 7, 2015 11:57 AM (in response to sridharthiyagarajan)1 of 1 people found this helpfulWhat does your log4j.xml file look like?
-
2. Re: How to prevent application logs getting logged in server.log in Wildfly 8.2.0 Final AS
mayerw01 Aug 8, 2015 6:39 AM (in response to sridharthiyagarajan)1 of 1 people found this helpfulI am not sure having understood your question. But you should be able to suppress the application log entries by adding a <logger category= > entry to your standalone-full-ha.xml
-
3. Re: How to prevent application logs getting logged in server.log in Wildfly 8.2.0 Final AS
sridharthiyagarajan Aug 10, 2015 5:42 AM (in response to jaikiran)Many thanks for the response.. Jaikiran and Wolfgang Mayer. I followed the below steps provided in the link https://docs.jboss.org/author/display/WFLY8/How+To#HowTo-HowdoIusemyownversionoflog4j%3F and
1. Added the below lines under <subsystem xmlns="urn:jboss:domain:logging:2.0"> in standalone-full-ha.xml.
<add-logging-api-dependencies value="false"/>
<use-deployment-logging-config value="true"/>
2. Added a lib folder containing log4j.jar in an EAR.
After doing the above steps, I could see application logs are not getting appended with server.log. But, I am observing below errors:
1. Getting the below in server.log.
ERROR [stderr] (MSC service thread 1-6) log4j:WARN No appenders could be found for logger (com.test.util.logging.LogFactory).
ERROR [stderr] (MSC service thread 1-6) log4j:WARN Please initialize the log4j system properly.
ERROR [stderr] (MSC service thread 1-6) log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
In the link Apache log4j 1.2 - Frequently Asked Technical Questions, log4j.properties or log4j.xml is mandatory for log4j initialization. But, below line of code is used to create logs.
org.apache.log4j.xml.DOMConfigurator.configureAndWatch(log4j file path)
I am migrating EAR application from JBoss 6 AS to Wildfly 8.2.0 AS and while observing JBoss 6 AS boot.log, log4j.defaultInitOverride: true is found. So, I tried the same setting in Wildfly 8.2.0 AS as well but still the mentioned error appears.
2. I have @startup EJBs logging some information in application logs and following per-deployment logging stopped logging those startup information. Is this because of the first issue as log4j is not configured well initially.
Please help. Many thanks.
-
4. Re: How to prevent application logs getting logged in server.log in Wildfly 8.2.0 Final AS
sridharthiyagarajan Aug 10, 2015 12:10 PM (in response to sridharthiyagarajan)Hello,
Just adding to my previous comments, I tried first option provided in the link http://www.mastertheboss.com/jboss-server/jboss-log/using-log4j-with-jboss-as-7-and-wildfly.
1. Added log4j.xml under META-INF of EAR.
2. Added org.apache.log4j module as one of the dependencies attribute in MANIFEST.MF.
3. It was mentioned to add a VM argument -Dorg.jboss.as.logging.per-deployment=true but I did not add.
server.log is generated fine and application logs are getting generated fine but I have below concerns:
1. <log4j:configuration threshold="warn"> is the starting tag in log4j.xml and it has "warn" as value of threshold attribute. But, I am getting all kind of logs (i.e. works as ALL or DEBUG threshold).
2. I have placed log4j.xml in META-INF of EAR. So, will org.apache.log4j.xml.DOMConfigurator.configureAndWatch(log4j file path) work where path denotes log4j.xml in META-INF ? Default time out is 60 seconds and if I change threshold, will it reflect ?
Please help me in resolving the concerns. Many thanks in advance.
-
5. Re: How to prevent application logs getting logged in server.log in Wildfly 8.2.0 Final AS
jamezp Aug 10, 2015 7:09 PM (in response to sridharthiyagarajan)I don't know if you sorted out your first question or not, but if not could you define what you mean by "application logs"?
There's no need to add the MANIFEST.MF dependency. It should be automatically added unless you exclude the logging subsystem in a jboss-deployment-structure.xml or change the add-logging-api-dependencies to false.
1. <log4j:configuration threshold="warn"> is the starting tag in log4j.xml and it has "warn" as value of threshold attribute. But, I am getting all kind of logs (i.e. works as ALL or DEBUG threshold).
I'm not sure why that would be without seeing the full log4j.xml.
2. I have placed log4j.xml in META-INF of EAR. So, will org.apache.log4j.xml.DOMConfigurator.configureAndWatch(log4j file path) work where path denotes log4j.xml in META-INF ? Default time out is 60 seconds and if I change threshold, will it reflect ?
That is the correct place to put the configuration file in an EAR. During deployment the configureAndWatch is not used only the DOMConfigurator.doConfigure() is used. If you need to make runtime configuration changes I'd suggest not using a configuration file. The logging subsystem will allow you to configure logging for an application with logging-profiles.
--
James R. Perkins
-
6. Re: How to prevent application logs getting logged in server.log in Wildfly 8.2.0 Final AS
gurusathish Aug 12, 2015 1:48 AM (in response to sridharthiyagarajan)Hi Sridhar,
I had the same goal set for managing the logs in WildFly 8.2.0. Finally I achieved the goal for segregating the logs into different file. I think this may help you.
Following configuration is to achieve this goal
INFO -> server_info.log
WARN & ERROR -> server_error.log
JBOSS logs goes to -> server.log
Step 1:
Dependencies: org.apache.log4j
Please place the above text in the MANIFEST.MF file which is in standalone/deployments/application.war/META-INF/MANIFEST.MF
Step 2
Place the attached log4j.xml file in the classpath WEB-INF/classes/log4j.xml
-
MANIFEST.MF 53 bytes
-
log4j.xml.zip 1.1 KB
-
-
7. Re: How to prevent application logs getting logged in server.log in Wildfly 8.2.0 Final AS
gurusathish Aug 12, 2015 1:56 AM (in response to sridharthiyagarajan)1 of 1 people found this helpfulHi Sridhar,
Set the priority level to WARN .
set priority to min and max to WARN then you will only get WARN logs in the log file.
<!-- TO PREVENT LOGGING THE LOWER PRIORITY OF WARN. AND TO LOG ONLY WARN-->
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="WARN" />
<param name="levelMax" value="WARN" />
</filter>
-
8. Re: How to prevent application logs getting logged in server.log in Wildfly 8.2.0 Final AS
sridharthiyagarajan Aug 17, 2015 4:09 AM (in response to sridharthiyagarajan)Many thanks for the response.. Sathish. There is a watchdog feature in log4j which I have to retain and sure.. I will try this option and comment out. Thanks again.