Использование аннотаций Lombok для логирования
This commit is contained in:
5
pom.xml
5
pom.xml
@@ -119,6 +119,11 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.16.16</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- TESTING -->
|
<!-- TESTING -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -4,13 +4,12 @@
|
|||||||
*/
|
*/
|
||||||
package kinosearch.webapp;
|
package kinosearch.webapp;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.jetty.server.Server;
|
import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
import org.eclipse.jetty.servlet.ServletHolder;
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Slf4jLog;
|
import org.eclipse.jetty.util.log.Slf4jLog;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.web.context.ContextLoaderListener;
|
import org.springframework.web.context.ContextLoaderListener;
|
||||||
@@ -20,8 +19,8 @@ import org.springframework.web.servlet.DispatcherServlet;
|
|||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class WebApp {
|
public class WebApp {
|
||||||
private final Logger logger = LoggerFactory.getLogger(WebApp.class);
|
|
||||||
private final String host;
|
private final String host;
|
||||||
private final int port;
|
private final int port;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -40,7 +39,7 @@ public class WebApp {
|
|||||||
server.start();
|
server.start();
|
||||||
server.join();
|
server.join();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Start server", e);
|
log.error("Start server", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import kinosearch.core.Kino;
|
|||||||
import kinosearch.core.KinoPlay;
|
import kinosearch.core.KinoPlay;
|
||||||
import kinosearch.core.Tools;
|
import kinosearch.core.Tools;
|
||||||
import kinosearch.core.warez.KinoWarez;
|
import kinosearch.core.warez.KinoWarez;
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.BeanFactoryUtils;
|
import org.springframework.beans.factory.BeanFactoryUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
@@ -32,8 +31,8 @@ import java.net.URL;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
|
@Slf4j
|
||||||
public class WebAppController {
|
public class WebAppController {
|
||||||
private final Logger logger = LoggerFactory.getLogger(WebAppController.class);
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApplicationContext coreContext;
|
private ApplicationContext coreContext;
|
||||||
|
|
||||||
@@ -181,7 +180,7 @@ public class WebAppController {
|
|||||||
con.disconnect();
|
con.disconnect();
|
||||||
connected = false;
|
connected = false;
|
||||||
_try++;
|
_try++;
|
||||||
logger.warn("Error connection to '{}': '{}'. Try again...", url.toString(), e.getMessage());
|
log.warn("Error connection to '{}': '{}'. Try again...", url.toString(), e.getMessage());
|
||||||
}
|
}
|
||||||
} while (!connected && _try < 3);
|
} while (!connected && _try < 3);
|
||||||
|
|
||||||
@@ -233,7 +232,7 @@ public class WebAppController {
|
|||||||
try {
|
try {
|
||||||
response.sendError(404);
|
response.sendError(404);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.warn("favicon 404", e);
|
log.warn("favicon 404", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user