migrated to slf4j
This commit is contained in:
@ -32,11 +32,6 @@
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
|
||||
@ -17,8 +17,8 @@ import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
import javax.transaction.Transactional;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
|
||||
@ -29,7 +29,7 @@ import org.apache.shiro.subject.Subject;
|
||||
@Stateless
|
||||
public class AccountControl {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(AccountControl.class.getName());
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AccountControl.class.getName());
|
||||
|
||||
@EJB
|
||||
private ConfigService configService;
|
||||
@ -105,7 +105,7 @@ public class AccountControl {
|
||||
account.setRoleEntityList(new ArrayList<>());
|
||||
account.getRoleEntityList().add(role);
|
||||
em.merge(account);
|
||||
LOGGER.log(Level.INFO, "Added role " + roleName + " to user " + account.getUsername());
|
||||
LOGGER.info("Added role " + roleName + " to user " + account.getUsername());
|
||||
|
||||
} else if (!account.getRoleEntityList().get(0).equals(role)) {
|
||||
// change role from User to Admin and vice versa
|
||||
@ -118,7 +118,7 @@ public class AccountControl {
|
||||
account.getRoleEntityList().remove(0);
|
||||
account.getRoleEntityList().add(role);
|
||||
em.merge(account);
|
||||
LOGGER.log(Level.INFO, "Switched role of user " + account.getUsername() + " to " + roleName);
|
||||
LOGGER.info("Switched role of user " + account.getUsername() + " to " + roleName);
|
||||
|
||||
}
|
||||
}
|
||||
@ -132,7 +132,7 @@ public class AccountControl {
|
||||
String currentUserName = currentUser.getPrincipal().toString();
|
||||
|
||||
if (account.getUsername().equals(currentUserName)) {
|
||||
throw new AccountException ("Cannot delete own account");
|
||||
throw new AccountException("Cannot delete own account");
|
||||
} else {
|
||||
account.setStatus("DELETED"); // TODO add enum
|
||||
account.setLastUpdatedBy(currentUserName);
|
||||
@ -146,12 +146,12 @@ public class AccountControl {
|
||||
try {
|
||||
AccountEntity account = getAccountEntity(userName, false);
|
||||
if (account == null) {
|
||||
LOGGER.log(Level.WARN, "Account with name " + userName + " not found");
|
||||
LOGGER.warn("Account with name " + userName + " not found");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (account.getStatus().equals("LOCKED")) { // TODO add enumType
|
||||
LOGGER.log(Level.WARN, "Account " + userName + " is locked, cannot initialize password reset");
|
||||
LOGGER.warn("Account " + userName + " is locked, cannot initialize password reset");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -169,9 +169,9 @@ public class AccountControl {
|
||||
em.merge(account);
|
||||
return true;
|
||||
} catch (MailException ex) {
|
||||
LOGGER.log(Level.ERROR, "Error while sending password reset mail. " + ex.toString());
|
||||
LOGGER.error("Error while sending password reset mail. " + ex.toString());
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.log(Level.DEBUG, "Error while sending password reset mail.", ex);
|
||||
LOGGER.debug("Error while sending password reset mail.", ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -181,7 +181,7 @@ public class AccountControl {
|
||||
AccountEntity account = getAccountEntity(userName, false);
|
||||
|
||||
if (account == null) {
|
||||
LOGGER.log(Level.WARN, "Error while resetting password, no account with username " + userName + " found");
|
||||
LOGGER.warn("Error while resetting password, no account with username " + userName + " found");
|
||||
// TODO add extra logging for intrusion protection system like fail2ban
|
||||
return false;
|
||||
}
|
||||
@ -193,23 +193,23 @@ public class AccountControl {
|
||||
if (storedHash.equals(resetPasswordToken)) {
|
||||
// everything ok, reset password
|
||||
executePasswordReset(account, newPassword);
|
||||
LOGGER.log(Level.INFO, "Updated password for user " + userName);
|
||||
LOGGER.info("Updated password for user " + userName);
|
||||
return true;
|
||||
} else {
|
||||
// token is not valid, refuse to change password
|
||||
LOGGER.log(Level.WARN, "Trying to reset password for user " + userName + " but wrong token " + resetPasswordToken + " provided");
|
||||
LOGGER.warn("Trying to reset password for user " + userName + " but wrong token " + resetPasswordToken + " provided");
|
||||
addLoginError(account);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// password reset token no longer valid
|
||||
LOGGER.log(Level.WARN, "Trying to reset password for user " + userName + " but token is no longer valid");
|
||||
LOGGER.warn("Trying to reset password for user " + userName + " but token is no longer valid");
|
||||
addLoginError(account);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// user is not is password reset mode
|
||||
LOGGER.log(Level.WARN, "Trying to reset password for user " + userName + " but password reset was not requested");
|
||||
LOGGER.warn("Trying to reset password for user " + userName + " but password reset was not requested");
|
||||
addLoginError(account);
|
||||
return false;
|
||||
}
|
||||
@ -257,7 +257,7 @@ public class AccountControl {
|
||||
int maxFailedLogins = configService.getMaxFailedLogins();
|
||||
if ((account.getFailureCount() >= maxFailedLogins) && (!account.getStatus().equals("LOCKED"))) { // TOD add status enum
|
||||
// max failed logins reached, disabling user
|
||||
LOGGER.log(Level.INFO, "Locking account " + account.getUsername() + " due to " + account.getFailureCount() + " failed logins");
|
||||
LOGGER.info( "Locking account " + account.getUsername() + " due to " + account.getFailureCount() + " failed logins");
|
||||
account.setStatus("LOCKED"); // TODO add enum
|
||||
}
|
||||
|
||||
|
||||
@ -13,8 +13,8 @@ import javax.ejb.Stateless;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -23,7 +23,7 @@ import org.apache.log4j.Logger;
|
||||
@Stateless
|
||||
public class MailTemplateService {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(MailTemplateService.class.getName());
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MailTemplateService.class.getName());
|
||||
|
||||
@PersistenceContext
|
||||
EntityManager em;
|
||||
@ -34,7 +34,7 @@ public class MailTemplateService {
|
||||
query.setParameter("templateName", templateName);
|
||||
MailTemplateEntity templateEntity = (MailTemplateEntity) query.getSingleResult();
|
||||
if (templateEntity == null) {
|
||||
LOGGER.log(Level.ERROR, "Tempate with name " + templateName + " not found");
|
||||
LOGGER.error( "Tempate with name " + templateName + " not found");
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -54,9 +54,9 @@ public class MailTemplateService {
|
||||
return templateString;
|
||||
} catch (Exception ex) {
|
||||
String hint = "Error while processing template with name " + templateName + ".";
|
||||
LOGGER.log(Level.ERROR, hint + " " + ex.toString());
|
||||
LOGGER.error( hint + " " + ex.toString());
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.log(Level.DEBUG, hint, ex);
|
||||
LOGGER.debug( hint, ex);
|
||||
}
|
||||
throw new MailTemplateException(hint, ex);
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package de.muehlencord.shared.account.util;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.shiro.authc.credential.DefaultPasswordService;
|
||||
import org.apache.shiro.crypto.hash.DefaultHashService;
|
||||
import org.apache.shiro.crypto.hash.Sha512Hash;
|
||||
@ -12,7 +12,7 @@ import org.apache.shiro.crypto.hash.Sha512Hash;
|
||||
*/
|
||||
public class SecurityUtil {
|
||||
|
||||
private final static Logger LOGGER = Logger.getLogger (SecurityUtil.class.getName());
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(SecurityUtil.class.getName());
|
||||
|
||||
public static String createPassword(String clearTextPassword) {
|
||||
// TODO read values from shiro.ini
|
||||
@ -26,7 +26,7 @@ public class SecurityUtil {
|
||||
|
||||
// try to encrypt password
|
||||
String encryptedPassword = passwordService.encryptPassword(clearTextPassword);
|
||||
LOGGER.log (Level.TRACE, encryptedPassword);
|
||||
LOGGER.trace(encryptedPassword);
|
||||
return encryptedPassword;
|
||||
}
|
||||
|
||||
|
||||
@ -27,9 +27,8 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@ -3,8 +3,8 @@ package de.muehlencord.shared.configuration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
@ -14,7 +14,7 @@ import org.apache.logging.log4j.Logger;
|
||||
*/
|
||||
public abstract class Parameter<T> {
|
||||
|
||||
private final static Logger LOGGER = LogManager.getLogger(Parameter.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(Parameter.class);
|
||||
|
||||
/** the name of the parameter */
|
||||
private String name;
|
||||
|
||||
@ -21,12 +21,8 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
|
||||
@ -14,9 +14,8 @@ import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
@ -25,7 +24,7 @@ import org.apache.logging.log4j.Logger;
|
||||
*/
|
||||
public class AuthenticationFilter implements Filter {
|
||||
|
||||
private final static Logger LOGGER = LogManager.getLogger(AuthenticationFilter.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(AuthenticationFilter.class);
|
||||
private final static String USER = AuthenticationFilter.class.getName() + "_user";
|
||||
private String loginPage;
|
||||
private String errorPage;
|
||||
@ -93,7 +92,7 @@ public class AuthenticationFilter implements Filter {
|
||||
pw.print("</html>");
|
||||
|
||||
} catch (Exception ex) {
|
||||
LOGGER.log(Level.ERROR, errorMsg, ex);
|
||||
LOGGER.error(errorMsg, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration>
|
||||
<Appenders>
|
||||
<Console name="STDOUT" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Logger name="org.apache.log4j.xml" level="info"/>
|
||||
<Root level="debug">
|
||||
<AppenderRef ref="STDOUT"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
@ -44,12 +44,8 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.muehlencord.shared</groupId>
|
||||
|
||||
@ -1,19 +1,17 @@
|
||||
package de.muehlencord.shared.network;
|
||||
|
||||
import de.muehlencord.shared.network.whois.NetworkInformation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.commons.net.util.SubnetUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
*
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
public class NetworkScanner {
|
||||
|
||||
private final static Logger LOGGER = LogManager.getLogger(NetworkScanner.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(NetworkScanner.class);
|
||||
|
||||
private String networkString;
|
||||
// private NetworkInformation networkInformation = null; // TODO add scan for information
|
||||
|
||||
@ -5,8 +5,8 @@ import java.net.Socket;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -14,7 +14,7 @@ import org.apache.logging.log4j.Logger;
|
||||
*/
|
||||
public final class PortScan {
|
||||
|
||||
private final static Logger LOGGER = LogManager.getLogger(PortScan.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(PortScan.class);
|
||||
|
||||
private PortScan() {
|
||||
// hide constructor
|
||||
|
||||
@ -7,16 +7,15 @@ import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
*
|
||||
* @author joern.muehlencord
|
||||
*/
|
||||
public class PortScanner {
|
||||
|
||||
private final static Logger LOGGER = LogManager.getLogger(PortScanner.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(PortScanner.class);
|
||||
|
||||
private final int startPort;
|
||||
private final int endPort;
|
||||
|
||||
@ -10,9 +10,8 @@ import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
*
|
||||
* @author joern@muehlencord.de
|
||||
@ -22,7 +21,7 @@ public class FTPConnection {
|
||||
/** the default timeout in ms */
|
||||
public static final int DEFAULTTIMEOUT = 30000;
|
||||
/** the logger object */
|
||||
private final static Logger LOGGER = LogManager.getLogger(FTPConnection.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(FTPConnection.class);
|
||||
/** the username to connect with */
|
||||
private String userName;
|
||||
/** the password to connect with */
|
||||
|
||||
@ -16,9 +16,8 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
* Communication endpoint for posting a messages
|
||||
*
|
||||
@ -26,7 +25,7 @@ import org.apache.logging.log4j.Logger;
|
||||
*/
|
||||
public class HttpLayer {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(HttpLayer.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HttpLayer.class);
|
||||
/** the url to post to */
|
||||
private final String destinationUrlString;
|
||||
/** the encoding to use */
|
||||
@ -101,7 +100,7 @@ public class HttpLayer {
|
||||
} catch (IOException ioex) {
|
||||
// store received exception but first get output and
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(ioex);
|
||||
LOGGER.debug("Error while sending message", ioex);
|
||||
}
|
||||
exceptionDuringPost = ioex;
|
||||
}
|
||||
@ -120,7 +119,7 @@ public class HttpLayer {
|
||||
}
|
||||
|
||||
} catch (IOException ioex) {
|
||||
LOGGER.error(ioex);
|
||||
LOGGER.error("Error while sending message", ioex);
|
||||
exceptionDuringPost = ioex;
|
||||
}
|
||||
|
||||
|
||||
@ -15,8 +15,8 @@ import javax.mail.internet.MimeMessage;
|
||||
import javax.mail.search.MessageIDTerm;
|
||||
import javax.mail.search.SearchTerm;
|
||||
import javax.mail.util.SharedByteArrayInputStream;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* MailReader to connect and work with IMAP mailboxes. Also works with exchange servers.
|
||||
@ -26,7 +26,7 @@ import org.apache.logging.log4j.Logger;
|
||||
public abstract class DefaultMailReader implements MailReader {
|
||||
|
||||
/** the logging object */
|
||||
private final static Logger LOGGER = LogManager.getLogger(DefaultMailReader.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(DefaultMailReader.class);
|
||||
/** the store to connect with */
|
||||
private Store store = null;
|
||||
/** the smtp host to work with */
|
||||
|
||||
@ -17,8 +17,8 @@ import javax.mail.MessagingException;
|
||||
import javax.mail.Multipart;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import javax.mail.internet.MimeMultipart;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Util class to convert between javax.mail.Message and MailMessage objects
|
||||
@ -30,7 +30,7 @@ public abstract class MailMessageUtils {
|
||||
/**
|
||||
* the logging object
|
||||
*/
|
||||
private static final Logger LOGGER = LogManager.getLogger(MailMessageUtils.class.getName());
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MailMessageUtils.class.getName());
|
||||
|
||||
/**
|
||||
* content type of mutipart messages - e.g. multipart_alternative or _mixed
|
||||
@ -96,7 +96,7 @@ public abstract class MailMessageUtils {
|
||||
LOGGER.debug("message subject = " + subject);
|
||||
messageId = getMessageId(message);
|
||||
LOGGER.debug("messageid = " + messageId);
|
||||
LOGGER.debug(mm.getSentDate());
|
||||
LOGGER.debug(mm.getSentDate().toString());
|
||||
|
||||
} catch (MessagingException ex) {
|
||||
throw new MailMessageException("Error while converting mime message. Reason: " + ex.getMessage(), ex);
|
||||
@ -203,8 +203,8 @@ public abstract class MailMessageUtils {
|
||||
String hint = "Unkonwn message format Converting MimeMessage of contentType " + contentType + " not yet implemented.";
|
||||
|
||||
try {
|
||||
LOGGER.debug(mm.getContent().getClass());
|
||||
LOGGER.debug(mm.getContent());
|
||||
LOGGER.debug(mm.getContent().getClass().toString());
|
||||
LOGGER.debug(mm.getContent().toString());
|
||||
LOGGER.error(hint);
|
||||
} catch (IOException | MessagingException ex) {
|
||||
LOGGER.debug(ex.toString(), ex);
|
||||
|
||||
@ -5,8 +5,8 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -17,7 +17,7 @@ public abstract class MailReaderConfigurationFactory {
|
||||
/**
|
||||
* the logging object
|
||||
*/
|
||||
private final static Logger LOGGER = LogManager.getLogger(MailReaderConfigurationFactory.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(MailReaderConfigurationFactory.class);
|
||||
|
||||
/**
|
||||
* reads the config file and creates a configured mailreader configuration
|
||||
|
||||
@ -4,9 +4,8 @@ import de.muehlencord.shared.network.mail.DefaultMailReader;
|
||||
import de.muehlencord.shared.network.mail.MailReaderConfiguration;
|
||||
import de.muehlencord.shared.network.mail.MailReaderConnectionException;
|
||||
import javax.mail.Session;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
* Implementation of MaiLReader to connect to an IMAP server
|
||||
*
|
||||
@ -15,7 +14,7 @@ import org.apache.logging.log4j.Logger;
|
||||
public class ImapMailReader extends DefaultMailReader {
|
||||
|
||||
/** the logger object */
|
||||
private final static Logger LOGGER = LogManager.getLogger(ImapMailReader.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(ImapMailReader.class);
|
||||
|
||||
/**
|
||||
* creates a new instance to connect to an IMAP (or MS Exchange) server
|
||||
|
||||
@ -4,9 +4,8 @@ import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
|
||||
import static de.muehlencord.shared.util.StringUtil.getValueBetweenKeywords;
|
||||
import java.text.ParseException;
|
||||
import java.util.Map;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -15,7 +14,7 @@ import org.apache.logging.log4j.Logger;
|
||||
public class ArinWhoisParser extends AbstractWhoisParser implements WhoisParser {
|
||||
|
||||
/** logger object */
|
||||
private final static Logger LOGGER = LogManager.getLogger(DefaultWhoisParser.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(DefaultWhoisParser.class);
|
||||
/** information to be returned */
|
||||
private WhoisInformation whoisInformation;
|
||||
|
||||
|
||||
@ -2,9 +2,8 @@ package de.muehlencord.shared.network.whois;
|
||||
|
||||
import static de.muehlencord.shared.network.CidrTool.rangeToCidrList;
|
||||
import java.util.Map;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
/**
|
||||
*
|
||||
* @author jomu
|
||||
@ -12,7 +11,7 @@ import org.apache.logging.log4j.Logger;
|
||||
public class DefaultWhoisParser extends AbstractWhoisParser implements WhoisParser {
|
||||
|
||||
/** logger object */
|
||||
private final static Logger LOGGER = LogManager.getLogger(DefaultWhoisParser.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(DefaultWhoisParser.class);
|
||||
/** information to be returned */
|
||||
private WhoisInformation whoisInformation;
|
||||
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration>
|
||||
<Appenders>
|
||||
<Console name="STDOUT" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Logger name="org.apache.log4j.xml" level="info"/>
|
||||
<Root level="debug">
|
||||
<AppenderRef ref="STDOUT"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
@ -1,12 +1,6 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package de.muehlencord.shared.network.whois;
|
||||
|
||||
import de.muehlencord.shared.network.BaseTest;
|
||||
import de.muehlencord.shared.network.whois.WhoisInformation;
|
||||
import de.muehlencord.shared.network.whois.WhoisException;
|
||||
import java.io.IOException;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
13
pom.xml
13
pom.xml
@ -27,7 +27,7 @@
|
||||
<commons-codec.version>1.10</commons-codec.version>
|
||||
<commons-net.version>3.3</commons-net.version>
|
||||
<commons-lang3.version>3.4</commons-lang3.version>
|
||||
<log4j.version>2.4.1</log4j.version>
|
||||
<slf4j.version>1.7.13</slf4j.version>
|
||||
<javax-mail.version>1.4.7</javax-mail.version>
|
||||
<javaee-api.version>7.0</javaee-api.version>
|
||||
<edtFTPj.version>1.5.3</edtFTPj.version>
|
||||
@ -65,14 +65,9 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@ -31,12 +31,8 @@
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration>
|
||||
<Appenders>
|
||||
<Console name="STDOUT" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Logger name="org.apache.log4j.xml" level="info"/>
|
||||
<Root level="debug">
|
||||
<AppenderRef ref="STDOUT"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
@ -256,12 +256,8 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -14,8 +14,8 @@ import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Node;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
@ -27,7 +27,7 @@ import org.xml.sax.SAXException;
|
||||
public abstract class SPJaxbObject<T> extends AbstractSpJaxbObject {
|
||||
|
||||
/** the logging object. */
|
||||
private final static Logger LOGGER = LogManager.getLogger(SPJaxbObject.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(SPJaxbObject.class);
|
||||
|
||||
/**
|
||||
* list of packages to search in
|
||||
|
||||
@ -2,8 +2,8 @@ package de.muehlencord.shared.sharepoint.api;
|
||||
|
||||
import javax.xml.bind.ValidationEvent;
|
||||
import javax.xml.bind.ValidationEventHandler;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
@ -12,7 +12,7 @@ import org.apache.logging.log4j.Logger;
|
||||
*/
|
||||
public class SPValidationEventHandler implements ValidationEventHandler {
|
||||
|
||||
private final static Logger LOGGER = LogManager.getLogger(SPValidationEventHandler.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(SPValidationEventHandler.class);
|
||||
|
||||
@Override
|
||||
public boolean handleEvent(ValidationEvent event) {
|
||||
|
||||
@ -9,9 +9,8 @@ import javax.xml.soap.SOAPMessage;
|
||||
import javax.xml.ws.handler.MessageContext;
|
||||
import javax.xml.ws.handler.soap.SOAPHandler;
|
||||
import javax.xml.ws.handler.soap.SOAPMessageContext;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -22,7 +21,7 @@ public class ServiceLogHandler implements SOAPHandler<SOAPMessageContext> {
|
||||
/**
|
||||
* the logging object.
|
||||
*/
|
||||
private final static Logger LOGGER = LogManager.getLogger(ServiceLogHandler.class);
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(ServiceLogHandler.class);
|
||||
|
||||
@Override
|
||||
public Set<QName> getHeaders() {
|
||||
@ -55,16 +54,16 @@ public class ServiceLogHandler implements SOAPHandler<SOAPMessageContext> {
|
||||
boolean isOutboundMessage = (Boolean) arg0.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
if (isOutboundMessage) {
|
||||
LOGGER.log(Level.TRACE, "OUTBOUND MESSAGE");
|
||||
LOGGER.trace( "OUTBOUND MESSAGE");
|
||||
} else {
|
||||
LOGGER.log(Level.TRACE, "INBOUND MESSAGE");
|
||||
LOGGER.trace( "INBOUND MESSAGE");
|
||||
}
|
||||
}
|
||||
try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
|
||||
message.writeTo(os);
|
||||
LOGGER.log(Level.TRACE, os.toString("UTF-8"));
|
||||
LOGGER.trace(os.toString("UTF-8"));
|
||||
} catch (SOAPException | IOException e) {
|
||||
LOGGER.log(Level.DEBUG, e.toString(), e);
|
||||
LOGGER.debug(e.toString(), e);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@ -19,9 +19,8 @@ import javax.xml.bind.JAXBException;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.ws.BindingProvider;
|
||||
import javax.xml.ws.handler.Handler;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
@ -34,7 +33,7 @@ import org.xml.sax.SAXException;
|
||||
*/
|
||||
public class SPUserGroup extends SPObject {
|
||||
|
||||
private final static Logger LOGGER = LogManager.getLogger(SPUserGroup.class.getName());
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(SPUserGroup.class.getName());
|
||||
|
||||
public SPUserGroup(SPContext context) {
|
||||
super(context);
|
||||
@ -80,19 +79,19 @@ public class SPUserGroup extends SPObject {
|
||||
if ((attributes.getNamedItem("LoginName") != null)
|
||||
&& (attributes.getNamedItem("LoginName").getNodeValue().equals("i:0#.w|" + userLoginName))) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.log(Level.DEBUG, "User " + userLoginName + " is member of group " + groupName);
|
||||
LOGGER.debug("User " + userLoginName + " is member of group " + groupName);
|
||||
}
|
||||
return true; // user found
|
||||
}
|
||||
}
|
||||
}
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.log(Level.DEBUG, "User " + userLoginName + " is not a member of group " + groupName);
|
||||
LOGGER.debug("User " + userLoginName + " is not a member of group " + groupName);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.log(Level.DEBUG, "User " + userLoginName + " not found");
|
||||
LOGGER.debug("User " + userLoginName + " not found");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -29,13 +29,8 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<type>jar</type>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@ -2,9 +2,8 @@ package de.muehlencord.shared.util;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.ParseException;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -13,7 +12,7 @@ import org.apache.logging.log4j.Logger;
|
||||
public abstract class StringUtil {
|
||||
|
||||
/** the logging object */
|
||||
private static final Logger LOGGER = LogManager.getLogger(StringUtil.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(StringUtil.class);
|
||||
|
||||
/**
|
||||
* returns the given string in ISO-8859-1 encoding
|
||||
@ -28,7 +27,7 @@ public abstract class StringUtil {
|
||||
byte[] b = input.getBytes("UTF-8");
|
||||
return new String(b, "ISO-8859-1");
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
LOGGER.log (Level.DEBUG, ex.toString(), ex);
|
||||
LOGGER.debug (ex.toString(), ex);
|
||||
throw new StringEncodingException("Cannot convert string from UTF-8 to ISO-8859-1. Reason: " + ex.getMessage(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,9 +19,8 @@ import java.text.Format;
|
||||
import static java.util.Arrays.asList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -32,7 +31,7 @@ public abstract class FileUtil {
|
||||
/**
|
||||
* the logging object
|
||||
*/
|
||||
private static final Logger LOGGER = LogManager.getLogger(FileUtil.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FileUtil.class);
|
||||
|
||||
/**
|
||||
* returns a list of files found by the given regexp in the given folder
|
||||
@ -203,7 +202,7 @@ public abstract class FileUtil {
|
||||
message = s.toString();
|
||||
} catch (FileNotFoundException fnex) {
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.log(Level.DEBUG, "Error occured while readoing file. Reason:" + fnex, fnex);
|
||||
LOGGER.debug("Error occured while readoing file. Reason:" + fnex, fnex);
|
||||
}
|
||||
throw new FileNotFoundException("Error occured while reading file. Reason:" + fnex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user