GithubHelp home page GithubHelp logo

logger-sc's Introduction

logger-sc

✔️ Simple, pretty and powerful logger for java

Introduction

The logger-sc forked from orhanobut/logger ,because it depends on Logcat of Android,we don't use it on other java project.I modify some source code,let it depends on log4j to make it more generally.

Setup

Add maven dependency

<!-- https://mvnrepository.com/artifact/com.github.gh351135612/logger-sc -->
<dependency>
    <groupId>com.github.gh351135612</groupId>
    <artifactId>logger-sc</artifactId>
    <version>1.1</version>
</dependency>

Initialize

Logger.addLogAdapter(new Log4jAdapter());

And use

Logger.addLogAdapter(new Log4jAdapter());
Logger.d("DEBUG级别日志");
Logger.i("INFO级别日志");
Logger.w("WARN级别日志");
Logger.e("ERROR级别日志");
Logger.d("hello %s", "world");
Logger.e(new Throwable("print error"),"log e");

Output

Warning

1.If you have configurated personally log4j.properties,the logger-sc won't work well.I suggest you configurate logrj.properties like this:

log4j.rootLogger=DEBUG,Console
#Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.Target=System.out
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=[%d{yyyy-MM-dd HH\:mm\:ss}][%p][LOGGER_SC]: %m%n

2.If you meet with log4j conflict,you can configurate like this:

<dependency>
    <groupId>com.github.gh351135612</groupId>
    <artifactId>logger-sc</artifactId>
    <version>1.1</version>
    <exclusions>
    <exclusion>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        </exclusion>
    </exclusions>
</dependency>

logger-sc's People

Contributors

orhanobut avatar hrskrs avatar ccunniff avatar yekmer avatar shiehnpin avatar joezorry avatar liryna avatar ljubisa987 avatar

Watchers

James Cloos avatar danfengzh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.