-
1. Re: wildfly 10 mail logger
lukaszracon Nov 27, 2017 11:51 AM (in response to johnsigeorge.mzcet)1 of 1 people found this helpfulTry this:
<subsystem xmlns="urn:jboss:domain:logging:3.0">
<async-handler name="EMAIL">
<level name="ERROR"/>
<queue-length value="100"/>
<overflow-action value="discard"/>
<subhandlers>
<handler name="emailHandler"/>
</subhandlers>
</async-handler>
<custom-handler name="emailHandler" class="org.apache.log4j.net.SMTPAppender" module="org.apache.log4j">
<level name="ERROR"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
<properties>
<property name="BufferSize" value="512"/>
<property name="To" value="app-exception@example.com"/>
<property name="From" value="sysadmin@example.com"/>
<property name="Subject" value="[${jboss.node.name}] Application Error"/>
<property name="SMTPHost" value="localhost"/>
</properties>
</custom-handler>
<root-logger>
<level name="WARN"/>
<handlers>
<handler name="EMAIL"/>
</handlers>
</root-logger>
</subsystem>
-
2. Re: wildfly 10 mail logger
jamezp Nov 30, 2017 2:09 PM (in response to lukaszracon)I'd suggest using CLI instead of editing the XML. Something like this should achieve the same results and not require shutting down WildFly and restarting it.
/subsystem=logging/custom-handler=emailHandler:add(class="org.apache.log4j.net.SMTPAppender", module="org.apache.log4j", level=ERROR, named-formatter=PATTERN, properties={BufferSize="512", To="app-exception@example.com", From="sysadmin@example.com", Subject="[${jboss.node.name}] Application Error", SMTPHost="localhost"}) /subsystem=logging/async-handler=async:add(queue-length=100, overflow-action=discard, handlers=[emailHandler]) /subsystem=logging/root-logger=ROOT:add-handler(name=async)
--
James R. Perkins
-
3. Re: wildfly 10 mail logger
johnsigeorge.mzcet Dec 1, 2017 1:47 AM (in response to jamezp)Thank you.Learned a new stuff.