In this post i will discuss about Log4J and Log files.
Log file is just simple file, which keep track of the record or event or info when any event happens or any software run. This whole process known as logging. We can create log file as simple log file.
Why Log file is required:
We can create log file for our simple script also so we can track or debug our script easily if anything goes wrong in script. For example, if our script is failing at some point then we can track back what went wrong
What is log4J
Log4j is free open source tool for creating log files It help us to generate log file.
Log4j is very lightweight and simple logging framework, comprising of three main components
Loggers
Appenders
Layouts
Download Log4J jar file.
1. Navigate to http://mvnrepository.com/
2. Search for Log4J
3. Download latest version of log4J
Create a Class file with below log levels:
logger.debug("Sample debug message");
logger.info("Sample info message");
logger.warn("Sample warn message");
logger.error("Sample error message");
logger.fatal("Sample fatal message");
Below is the sample code:
After executing test you can see logs in log4j.log file and in console as well.
OUTPUT of Log4J file:
Log file is just simple file, which keep track of the record or event or info when any event happens or any software run. This whole process known as logging. We can create log file as simple log file.
Why Log file is required:
We can create log file for our simple script also so we can track or debug our script easily if anything goes wrong in script. For example, if our script is failing at some point then we can track back what went wrong
What is log4J
Log4j is free open source tool for creating log files It help us to generate log file.
Log4j is very lightweight and simple logging framework, comprising of three main components
Loggers
Appenders
Layouts
Download Log4J jar file.
1. Navigate to http://mvnrepository.com/
2. Search for Log4J
3. Download latest version of log4J
Create a sample Java project and add log4J. jar file to project.
Create a properties file
Right click on Project --New --File
give a name log4j.properties.
and add below code in that file
Create a Class file with below log levels:
logger.debug("Sample debug message");
logger.info("Sample info message");
logger.warn("Sample warn message");
logger.error("Sample error message");
logger.fatal("Sample fatal message");
Below is the sample code:
After executing test you can see logs in log4j.log file and in console as well.
OUTPUT of Log4J file:
ugg boots, polo outlet, replica watches, tiffany jewelry, louis vuitton outlet, longchamp outlet, louboutin pas cher, tiffany and co, oakley sunglasses, gucci handbags, tory burch outlet, oakley sunglasses, jordan pas cher, ugg boots, kate spade outlet, polo ralph lauren, longchamp pas cher, burberry pas cher, longchamp outlet, prada handbags, christian louboutin, nike outlet, prada outlet, louis vuitton, jordan shoes, nike roshe, louis vuitton, louis vuitton outlet, christian louboutin uk, replica watches, christian louboutin outlet, nike air max, nike free, christian louboutin shoes, ray ban sunglasses, ray ban sunglasses, air max, oakley sunglasses, polo ralph lauren outlet online, nike free run, sac longchamp pas cher, uggs on sale, michael kors pas cher, chanel handbags, longchamp outlet, louis vuitton outlet, cheap oakley sunglasses, ray ban sunglasses, oakley sunglasses wholesale
ReplyDeletetrue religion outlet, nike air max uk, timberland pas cher, true religion outlet, michael kors, guess pas cher, michael kors, ray ban uk, michael kors outlet online, hollister uk, nike free uk, burberry outlet, michael kors outlet online, kate spade, mulberry uk, coach outlet store online, uggs outlet, nike air max, north face, sac vanessa bruno, new balance, coach outlet, vans pas cher, replica handbags, michael kors outlet, michael kors outlet online, nike blazer pas cher, lululemon canada, converse pas cher, oakley pas cher, michael kors outlet, ray ban pas cher, true religion outlet, burberry handbags, sac hermes, hogan outlet, nike roshe run uk, nike air force, north face uk, coach purses, michael kors outlet online, abercrombie and fitch uk, polo lacoste, nike air max uk, true religion jeans, michael kors outlet, uggs outlet, hollister pas cher, ralph lauren uk
ReplyDeletevans outlet, nike roshe run, hollister, iphone cases, north face outlet, insanity workout, beats by dre, nike trainers uk, ralph lauren, soccer jerseys, timberland boots, nike air max, bottega veneta, celine handbags, ferragamo shoes, mac cosmetics, chi flat iron, nike huaraches, lululemon, oakley, hollister, asics running shoes, herve leger, hollister clothing, baseball bats, ghd hair, north face outlet, valentino shoes, lancel, vans, jimmy choo outlet, hermes belt, giuseppe zanotti outlet, abercrombie and fitch, babyliss, mcm handbags, louboutin, ray ban, p90x workout, reebok outlet, nike air max, wedding dresses, mont blanc pens, soccer shoes, converse outlet, nfl jerseys, longchamp uk, gucci, new balance shoes, instyler
ReplyDeletewedding dresses, thomas sabo, pandora charms, swarovski crystal, ugg,ugg australia,ugg italia, karen millen uk, canada goose outlet, links of london, ugg pas cher, doudoune moncler, ugg uk, supra shoes, canada goose jackets, moncler outlet, coach outlet, swarovski, canada goose outlet, ugg,uggs,uggs canada, louis vuitton, canada goose outlet, pandora jewelry, moncler, louis vuitton, hollister, pandora uk, pandora jewelry, louis vuitton, canada goose, toms shoes, canada goose uk, replica watches, moncler, louis vuitton, moncler uk, louis vuitton, montre pas cher, ugg, moncler outlet, moncler, juicy couture outlet, canada goose, canada goose, moncler, marc jacobs, juicy couture outlet
ReplyDeletereally informative blog you have posted. i have ever seen such kind of article. so keep on sharing such kind of an interesting article.
ReplyDeleteselenium training in chennai
we are the leading oracle fusion financials training institutes search engine.
ReplyDeletewe have huge database regarding oracle institutions present in india. we can provide
complete institute details as we don't have money charge policy for the information
provided
Oracle fusion Financials Online Training in Ameerpet
Oracle Fusion Financials Training in Ameerpet
nike outlet store
ReplyDeletepandora outlet
michael kors outlet online
cheap nike shoes
pandora
michael kors outlet clearance
michael kors outlet
polo ralph lauren
canada goose jackets
ray ban sunglasses