https://github.com/jcabi/jcabi-log
Static Wrapper of SLF4J easing you from the necessity to create static LOGGER instances in each Java class
https://github.com/jcabi/jcabi-log
java logger logging slf4j
Last synced: 3 months ago
JSON representation
Static Wrapper of SLF4J easing you from the necessity to create static LOGGER instances in each Java class
- Host: GitHub
- URL: https://github.com/jcabi/jcabi-log
- Owner: jcabi
- License: other
- Created: 2013-08-21T06:17:47.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2025-06-07T10:02:34.000Z (4 months ago)
- Last Synced: 2025-06-07T11:18:23.515Z (4 months ago)
- Topics: java, logger, logging, slf4j
- Language: Java
- Homepage: https://log.jcabi.com
- Size: 4.65 MB
- Stars: 61
- Watchers: 8
- Forks: 46
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://www.elegantobjects.org)
[](https://www.rultor.com/p/jcabi/jcabi-log)
[](https://www.jetbrains.com/idea/)[](https://github.com/jcabi/jcabi-log/actions/workflows/mvn.yml)
[](https://www.0pdd.com/p?name=jcabi/jcabi-log)
[](https://codecov.io/gh/jcabi/jcabi-log)
[](https://maven-badges.herokuapp.com/maven-central/com.jcabi/jcabi-log)
[](https://www.javadoc.io/doc/com.jcabi/jcabi-log)
[](https://hitsofcode.com/view/github/jcabi/jcabi-log)More details are here: [log.jcabi.com](https://log.jcabi.com/index.html)
Read this blog post:
[_Get Rid of Java Static Loggers_](https://www.yegor256.com/2014/05/23/avoid-java-static-logger.html)`Logger` is a convenient static wrapper of
[slf4j](http://www.slf4j.org/)
(don't forget to include one of
[SLF4J Bindings](http://www.slf4j.org/manual.html#binding)
into the project):```java
import com.jcabi.log.Logger;
class Foo {
void bar(int value) {
Logger.debug(this, "method #bar(%d) was called", value);
}
}
```Besides standard `%s` placeholders inside the format string, you can use
other custom ones, which help formatting common values faster:* `%[file]s` --- absolute file name ➜ file name relative to current directory
* `%[text]s` --- any string ➜ pretty looking text, short enough, and escaped
* `%[exception]s` --- `Exception` ➜ stacktrace
* `%[list]s` --- `Iterable` ➜ pretty formatted list, in one line
* `%[size]s` --- size in bytes ➜ Kb, Mb, Gb, Tb, and so on
* `%[ms]s` --- milliseconds ➜ ms, sec, min, hours, etc.
* `%[nano]s` --- nanoseconds ➜ µs, ms, sec, min, hours, etc.
* `%[type]s` --- `Class>` ➜ name of it
* `%[secret]s` --- any string ➜ stars
* `%[dom]s` --- `org.w3c.domDocument` ➜ pretty printed/formatted XMLYou are welcome to
[suggest](https://github.com/jcabi/jcabi-log/blob/master/src/main/java/com/jcabi/log/DecorsManager.java)
your own "decors".## How to contribute?
Fork the repository, make changes, submit a pull request.
We promise to review your changes same day and apply to
the `master` branch, if they look correct.Please run Maven build before submitting a pull request:
```bash
mvn clean install -Pqulice
```