/// <summary> Configures the logging to email /// </summary> private void configureEmail() { System.String smtpHost = rsvc.getString(RuntimeConstants.LOGSYSTEM_LOG4J_EMAIL_SERVER); System.String emailFrom = rsvc.getString(RuntimeConstants.LOGSYSTEM_LOG4J_EMAIL_FROM); System.String emailTo = rsvc.getString(RuntimeConstants.LOGSYSTEM_LOG4J_EMAIL_TO); System.String emailSubject = rsvc.getString(RuntimeConstants.LOGSYSTEM_LOG4J_EMAIL_SUBJECT); System.String bufferSize = rsvc.getString(RuntimeConstants.LOGSYSTEM_LOG4J_EMAIL_BUFFER_SIZE); if (smtpHost == null || smtpHost.Trim().Equals("") || emailFrom == null || smtpHost.Trim().Equals("") || emailTo == null || emailTo.Trim().Equals("") || emailSubject == null || emailSubject.Trim().Equals("") || bufferSize == null || bufferSize.Trim().Equals("")) { return; } SMTPAppender appender = new SMTPAppender(); appender.SMTPHost = smtpHost; appender.From = emailFrom; appender.To = emailTo; appender.Subject = emailSubject; appender.BufferSize = System.Int32.Parse(bufferSize); appender.Layout = layout; appender.activateOptions(); logger.addAppender(appender); }
/// <summary> Configures the logging to email /// </summary> private void configureEmail() { System.String smtpHost = rsvc.getString(RuntimeConstants.LOGSYSTEM_LOG4J_EMAIL_SERVER); System.String emailFrom = rsvc.getString(RuntimeConstants.LOGSYSTEM_LOG4J_EMAIL_FROM); System.String emailTo = rsvc.getString(RuntimeConstants.LOGSYSTEM_LOG4J_EMAIL_TO); System.String emailSubject = rsvc.getString(RuntimeConstants.LOGSYSTEM_LOG4J_EMAIL_SUBJECT); System.String bufferSize = rsvc.getString(RuntimeConstants.LOGSYSTEM_LOG4J_EMAIL_BUFFER_SIZE); if (smtpHost == null || smtpHost.Trim().Equals("") || emailFrom == null || smtpHost.Trim().Equals("") || emailTo == null || emailTo.Trim().Equals("") || emailSubject == null || emailSubject.Trim().Equals("") || bufferSize == null || bufferSize.Trim().Equals("")) { return ; } SMTPAppender appender = new SMTPAppender(); appender.SMTPHost = smtpHost; appender.From = emailFrom; appender.To = emailTo; appender.Subject = emailSubject; appender.BufferSize = System.Int32.Parse(bufferSize); appender.Layout = layout; appender.activateOptions(); logger.addAppender(appender); }