migrated to slf4j
This commit is contained in:
@ -44,13 +44,9 @@
|
||||
<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>
|
||||
</dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.muehlencord.shared</groupId>
|
||||
<artifactId>shared-util</artifactId>
|
||||
|
||||
@ -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.*;
|
||||
|
||||
Reference in New Issue
Block a user