web stats
SMTP Appender in Mirth Log4J - Mirth Community

Go Back   Mirth Community > Mirth Connect > Development

Thread Tools Display Modes
Old 08-23-2012, 12:45 PM
mbs mbs is offline
What's HL7?
Join Date: Aug 2012
Posts: 4
mbs is on a distinguished road
Default SMTP Appender in Mirth Log4J

I'm trying to add a SMTP Appender in the log4j.properties file in the conf directory.

After adding the SMTP Appender I get:

log4j:WARN Error during default initialization
java.lang.NoClassDefFoundError: javax/mail/Multipart
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unk nown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.log4j.helpers.OptionConverter.instantia teByClassName(OptionConverter.java:330)
at org.apache.log4j.helpers.OptionConverter.instantia teByKey(OptionConverter.java:121)
at org.apache.log4j.PropertyConfigurator.parseAppende r(PropertyConfigurator.java:664)
at org.apache.log4j.PropertyConfigurator.parseCategor y(PropertyConfigurator.java:647)
at org.apache.log4j.PropertyConfigurator.configureRoo tCategory(PropertyConfigurator.java:544)
at org.apache.log4j.PropertyConfigurator.doConfigure( PropertyConfigurator.java:440)
at org.apache.log4j.PropertyConfigurator.doConfigure( PropertyConfigurator.java:476)
at org.apache.log4j.helpers.OptionConverter.selectAnd Configure(OptionConverter.java:471)
at org.apache.log4j.LogManager.<clinit>(LogManager.ja va:125)
at org.apache.log4j.Logger.getLogger(Logger.java:118)
at com.mirth.connect.server.launcher.MirthLauncher.<c linit>(MirthLauncher.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.exe4j.runtime.LauncherEngine.launch(Unknown Source)
at com.install4j.runtime.launcher.Launcher.main(Unkno wn Source)
Caused by: java.lang.ClassNotFoundException: javax.mail.Multipart
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 22 more

It's strange because Mirth comes with the JavaMail Jar in the lib directory. The error makes it seem as though Mirth cannot find the mail.jar.

I'm trying to do this because I've noticed that not all errors trigger alerts.

Here is the modified log4j.properties file:

# sample properties to initialize log4j
log4j.rootLogger = ERROR,stdout,fout,email

# stdout appender
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = %-5p %d [%t] %c: %m%n

# file appender
dir.logs = logs
log4j.appender.fout = org.apache.log4j.RollingFileAppender
log4j.appender.fout.File = ${dir.logs}/mirth.log
log4j.appender.fout.MaxFileSize = 500KB
log4j.appender.fout.MaxBackupIndex = 20
log4j.appender.fout.layout = org.apache.log4j.PatternLayout
log4j.appender.fout.layout.ConversionPattern = %-5p %d [%t] %c: %m%n

# email appender
log4j.appender.email = org.apache.log4j.net.SMTPAppender
log4j.appender.email.SMTPHost = localhost
log4j.appender.email.From = john@none
log4j.appender.email.To = bob@something.com
log4j.appender.email.Subject = "Mirth server error occured"
log4j.appender.email.BufferSize = 1
log4j.appender.email.layout = org.apache.log4j.PatternLayout
log4j.appender.email.layout.ConversionPattern = %-5p %d [%t] %c: %m%n

# splash screen
log4j.logger.com.mirth.connect.server.Mirth = INFO

# Mirth Connect channel logging
log4j.logger.transformer = DEBUG
log4j.logger.preprocessor = DEBUG
log4j.logger.postprocessor = DEBUG
log4j.logger.deploy = DEBUG
log4j.logger.shutdown = DEBUG
log4j.logger.filter = DEBUG
log4j.logger.db-connector = DEBUG
log4j.logger.js-connector = DEBUG

# SQL Logging
log4j.logger.java.sql = ERROR
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 03:56 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation