This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> | |
| <welcome-file-list> | |
| <welcome-file>index.jsp</welcome-file> | |
| <welcome-file>index.html</welcome-file> | |
| </welcome-file-list> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%@ page language="java" contentType="text/html; charset=ISO-8859-1" | |
| pageEncoding="ISO-8859-1"%> | |
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
| <title>Home page</title> | |
| </head> | |
| <body> | |
| Home page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apply plugin: 'com.bmuschko.tomcat' | |
| apply plugin: 'eclipse-wtp' | |
| buildscript { | |
| repositories { | |
| jcenter() | |
| } | |
| dependencies { | |
| classpath 'com.bmuschko:gradle-tomcat-plugin:2.4.1' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apply plugin: 'java-library' | |
| apply plugin: 'war' | |
| repositories { | |
| jcenter() | |
| } | |
| dependencies { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //this part will could be in constructor of the class | |
| Logger userLogger = LogManager.getLogger("userLoggerDB"); | |
| ... | |
| public void saveReaderUser(UserDTO user) { | |
| //code for saving user into database | |
| userLogger.info(“New user created: “ + user.getUsername()) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //somewhere in the method | |
| ThreadContext.put("username", "donkey_kong"); | |
| userLogger.info("New user"); | |
| ThreadContext.clearAll(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE `user_logs` ( | |
| `id` int(12) NOT NULL AUTO_INCREMENT, | |
| `level` varchar(10) NOT NULL, | |
| `dated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
| `username` varchar(64) NOT NULL, | |
| `field` varchar(60) NOT NULL, | |
| `from_value` varchar(1000) NOT NULL DEFAULT '', | |
| `to_value` varchar(1000) NOT NULL DEFAULT '', | |
| `message` varchar(500) NOT NULL, | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| dependencies { | |
| //some other dependencies | |
| compile 'org.apache.logging.log4j:log4j-api:2.10.0' | |
| compile 'org.apache.logging.log4j:log4j-core:2.10.0' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.wkrzywiec.spring.library.config; | |
| import java.sql.Connection; | |
| import java.sql.SQLException; | |
| import java.util.Properties; | |
| import javax.sql.DataSource; | |
| import org.apache.commons.dbcp.DriverManagerConnectionFactory; | |
| import org.apache.commons.dbcp.PoolableConnection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <Configuration name="ChangesLogs"> | |
| <Appenders> | |
| <Console name="consoleAppender" target="SYSTEM_OUT"> | |
| <PatternLayout pattern="%d | %level | %logger | %m" /> | |
| </Console> | |
| <JDBC name="userAppenderDB" tableName="user_logs"> | |
| <ConnectionFactory class="com.wkrzywiec.spring.library.config.LogsConnectionFactory" method="getDatabaseConnection" /> |
OlderNewer