@@ -17,7 +17,7 @@ Just add dependency to your project.
1717 <dependency >
1818 <groupId >io.appulse</groupId >
1919 <artifactId >logging-java</artifactId >
20- <version >1.0.2 </version >
20+ <version >1.1.0 </version >
2121 </dependency >
2222 ...
2323</dependencies >
@@ -26,9 +26,68 @@ Just add dependency to your project.
2626** Gradle** :
2727
2828``` groovy
29- compile 'io.appulse:logging-java:1.0.2 '
29+ compile 'io.appulse:logging-java:1.1.0 '
3030```
3131
32+ And use it as usual:
33+
34+ ``` java
35+ import org.slf4j.Logger ;
36+ import org.slf4j.LoggerFactory ;
37+
38+ public class SomeClass {
39+
40+ Logger log = LoggerFactory . getLogger(SomeClass . class);
41+
42+ public void doSomeLog () {
43+ log. info(" info message" );
44+ log. warn(" warn message" );
45+ log. error(" error message" );
46+ }
47+ }
48+ ```
49+
50+ or, if you use a Lombok Project:
51+
52+ ``` java
53+ import lombok.extern.slf4j.Slf4j ;
54+
55+ @Slf4j
56+ public class SomeClass {
57+
58+ public void doSomeLog () {
59+ log. info(" info message" );
60+ log. warn(" warn message" );
61+ log. error(" error message" );
62+ }
63+ }
64+ ```
65+
66+ With default configuration (no ` logback.xml ` in classpath at all) it looks like:
67+
68+ ![ override example] ( https://github.com/appulse-projects/logging-java/blob/master/.images/override_example.png?raw=true )
69+
70+ You also could to override default ` logback ` 's configuration, like an example below.
71+
72+ ** resources/logback.xml** :
73+
74+ ``` xml
75+ <?xml version =" 1.0" encoding =" UTF-8" ?>
76+
77+ <configuration >
78+ <property
79+ name =" CONSOLE_LOG_PATTERN"
80+ value =" ${CONSOLE_LOG_PATTERN:-%clr(${LOG_LEVEL_PATTERN:-%5p}) %clr([%25.25thread]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"
81+ />
82+
83+ <include resource =" io/appulse/logging/logback/base.xml" />
84+ </configuration >
85+ ```
86+
87+ And output will be like:
88+
89+ ![ override example] ( https://github.com/appulse-projects/logging-java/blob/master/.images/override_example.png?raw=true )
90+
3291## Development
3392
3493These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
0 commit comments