com.github.wasiqb.coteafs:logger

coteafs logging library.

License

License

GroupId

GroupId

com.github.wasiqb.coteafs
ArtifactId

ArtifactId

logger
Last Version

Last Version

2.6.0
Release Date

Release Date

Type

Type

jar
Description

Description

coteafs logging library.
Project Organization

Project Organization

Wasiq Bhamla

Download logger

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.wasiqb.coteafs/logger/ -->
<dependency>
    <groupId>com.github.wasiqb.coteafs</groupId>
    <artifactId>logger</artifactId>
    <version>2.6.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.wasiqb.coteafs/logger/
implementation 'com.github.wasiqb.coteafs:logger:2.6.0'
// https://jarcasting.com/artifacts/com.github.wasiqb.coteafs/logger/
implementation ("com.github.wasiqb.coteafs:logger:2.6.0")
'com.github.wasiqb.coteafs:logger:jar:2.6.0'
<dependency org="com.github.wasiqb.coteafs" name="logger" rev="2.6.0">
  <artifact name="logger" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.wasiqb.coteafs', module='logger', version='2.6.0')
)
libraryDependencies += "com.github.wasiqb.coteafs" % "logger" % "2.6.0"
[com.github.wasiqb.coteafs/logger "2.6.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.apache.logging.log4j : log4j-core jar 2.14.0
org.apache.logging.log4j : log4j-api jar 2.14.0

provided (4)

Group / Artifact Type Version
com.github.wasiqb.coteafs : datasource jar 1.2.0
com.epam.reportportal : logger-java-log4j jar 5.0.3
com.epam.reportportal : agent-java-testng jar 5.0.7
org.projectlombok : lombok jar 1.18.16

test (1)

Group / Artifact Type Version
org.testng : testng jar 7.3.0

Project Modules

There are no modules declared in this project.

Custom configurable logger framework in Java.

Open Source Love CircleCI Test Coverage Quality Gate Maintainability Reliability Security Vulnerability Duplicate Code Maven Central Github Releases License

💥 What's this all about?

coteafs-logger is a Java wrapper library build on top of log4j2. This library was created to simplify the logging as there is no need to add two dependency of log4j2. Also, the logger can be configured using different config formats ( Yaml, JSON, XML and properties)

What this library offers?

By default, if you don't provide the logger config, then it will not log anything, but, if the logger file is provided, it will log as per the config setting. To know more about the behavior of config file, check out it's repository here

Loggy Class

This library provides a utility class known as Loggy which simplifies the logging. Check the sample code below:

final Loggy log = Loggy.init ();
log.enter ("Code start");
log.i ("Testing info...");
log.w ("Testing warn...");
log.e ("Testing error...");
log.d ("Testing debug...");
log.c (ex);
log.t ("Testing trace...");
log.f ("Testing fatal...");
log.th (new Exception("Custom exception"));
log.exit ("Code completed.");

Will output the logs as:

[18:20:28.172] [TRACE] - Enter Entered method (TestLogging:126) 
[18:20:28.175] [INFO ] - Testing info... (TestLogging:207) 
[18:20:28.186] [WARN ] - Testing warn... (TestLogging:290) 
[18:20:28.188] [ERROR] - Catching (TestLogging:45) File Not found
[18:20:28.188] [ERROR] - Testing error... (TestLogging:115) 
[18:20:28.189] [DEBUG] - Testing debug... (TestLogging:80) 
[18:20:28.190] [TRACE] - Testing trace... (TestLogging:242) 
[18:20:28.191] [FATAL] - Testing fatal... (TestLogging:172) 
[18:20:28.192] [TRACE] - Exit: Exit method (TestLogging:137) 
[18:20:28.193] [ERROR] - Throwing (TestLogging:255) Custom exception

Logger config file

The config file should be placed in src/test/resources and file name must be logger-config. Following is the sample logger config which will create 1 rolling log file and also output the logs to console:

  1. new-log-main.log

The above generated files will be archived as per the configuration:

  • Every next day.
  • Log file size exceeds 5 mb.
  • On Every Automation Run.

logger-config.yml

status: WARN
log_dir: /logs
loggers:
  - name: console-log
    type: CONSOLE
    message_pattern: "[%d{HH:mm:ss.SSS}] [%-5level] - %msg (%logger{1}:%L) %throwable{short.message}%n"
    level: DEBUG
  - name: test-log-appender
    type: FILE
    file_name: new-log-main
    path_pattern: my-log-main-%d{yyyy-MM-dd}.log
    message_pattern: "[%d{HH:mm:ss.SSS}] [%-5level] - %msg (%logger{1}:%L) %throwable{short.message}%n"
    level: INFO
    archive:
      after_days: 1
      after_size: 5
      on_every_run: true

📌 Usage?

You can use the following dependency into your pom.xml to use this library.

<dependency>
    <groupId>com.github.wasiqb.coteafs</groupId>
    <artifactId>logger</artifactId>
    <version>2.5.0</version>
</dependency>

Need Assistance?

  • Directly chat with me on my site and I'll revert to you as soon as possible.
  • Discuss your queries by writing to me @ [email protected]
  • If you find any issue which is bottleneck for you, search the issue tracker to see if it is already raised.
  • If not raised, then you can create a new issue with required details as mentioned in the issue template.

What you do if you like the project?

  • Spread the word with your network.
  • Star the project to make the project popular.
  • Stay updated with the project progress by Watching it.
  • Contribute to fix open issues, documentations or add new features. To know more, see our contributing page.
  • I would be delighted if you can Sponsor this project and provide your support to open source development by clicking on the Sponsor button on the top of this repository.

✔️ Contributors

🎫 Versioning ideology

©️ Wasiq Bhamla

Versions

Version
2.6.0
2.5.0
2.4.0
2.3.0
2.2.0
2.1.2
2.1.1
2.1.0
2.0.2
2.0.1
2.0.0
1.8.0
1.7.0
1.6.0
1.5.0
1.4.0
1.3.0
1.2.0
1.1.0
1.0.0