I would like to create a logger class library. The requirements are
- Write the log in a file in a specified path
- Change the path of Log file
- Write the log in system console
- Write debug mode to the log file
- Generate separate log for WARNING, ERROR and INFO messages.
How can I begin this with out extending the Log4J or logger or any other built in libraries. Any guidance would be grateful.
Thanks in advance.
It would be simpler to just using log4j, java.util.logging, logback or some other existing Java logging framework. They are all capable of satisfying your requirements as stated.
This is apparently your beef …
The simple response to that is that Apache software is free, and the license is pretty permissive. If you have a specific issue with the Apache license, why not just use java.util.logging … which is licensed under the same terms as your Java platform.
Well apart from the above (i.e. don’t waste your time …), if you really want to implement a new logging framework, you should start by researching existing ones to understand what they do, how their APIs are designed and how their implementations work. (Otherwise you are going to produce something that nobody will want to use.) It would also help to find and read comparisons and critiques of the different frameworks.
That research should tell you where you need to start. If not, then you are probably not skilled / experienced enough to do this task yet … try something simpler.