A comprehensive log4J property profile

xiaoxiao2021-03-06  101

# Log4j.debug = true

# log4j.disable = Fatal

# Log4j.additivity.testlogging = false

Log4j.rootcategory =, DEST1

Log4j.category.testlogging = debug, dest1

log4j.appender.dest1 = org.apache.log4j.ConsoleAppender

# Log4j.appender.dest1.layout = org.apache.log4j.SimpleLayout

log4j.appender.dest1.layout = org.apache.log4j.PatternLayout

# Log4j.appender.dest1.layout.ConversionPattern =% - 5p% l% x:% m% n

! ---------------------- ####### End of property ####### ---------- ------------!

################################################## ###########################################

# Below I document in more detail how to write a log4j configuration file. #

# Selectively Copy Lines Beginning with #, Paste and UNcomment Them Above. #

################################################## ###########################################

! ------------------------------------------------- ----------------------------!

Place this file anywhere in classpath!

Appenders Are Additive by Default.!

! Priorities are inherited until overridden in a category.!

! In $ {property_key}, the value of the key can be defined as a system!

! Property or in this file itself. System Properties Area Searched First and!

!..!

! ------------------------------------------------- ----------------------------!

! ------------------------------------------------- ----------------------------!

CONFIGURE LOG4J's Operation At The Meta Level!

! ------------------------------------------------- ----------------------------!

Observe log4j paarsing this file! Watch log4j parsing this file # log4j.debug = true! Set this to false for log4j to actual Obey the log4j.disable property (next)

! Make the following log4j.disable will not be reset # log4j.disableoverride = false

! Disable all logging in all categories for Messages with Priority Equal To

Or Lower Than The One Given Here! Set global priority

# log4j.disable = info

! ------------------------------------------------- ----------------------------!

! Configure Categories (Loggers)!

! ------------------------------------------------- ----------------------------!

Root Category (Usually Sufficient To Set this One ONLY)

!, Logs Messages with priority debug (default) or higher

# log4j.rootcategory =, DEST1

OR,

# Log4j.rootcategory = debug, dest1, dest2

! Your Categories (To Customize Logging Per Class / PKG / Project / ETC)

!, Overrides Ancestor's Priority and Makes It Warn or Higher for this cat.

# log4j.category.testlogging = WARN, DEST3

OR,

# log4j.category.testlogging = debug, DEST3

! -------- Don't do this !!! Appenders Are Additive by Default !!! ---------------!

It will Write the Same Log Message TWICE to DEST1. ONCE for Root, Then For!

this category.!

! # Log4j.category.testlogging = debug, dest1, dest3!

! If you do not want additivity for this category, Say So!

! # Log4j.additivity.testlogging = false!

! ------------------------------------------------- ----------------------------!

! ------------------------------------------------- ----------------------------!

! Configure appenders (log destinations / targets) and their options !! ------------------------------------------------------------------------------------------------------------------ ----------------------------------------!

Write to console (stdout or stderr) output to the terminal

# log4j.appender.dest1 = org.apache.log4j.consoleAppender

# log4j.appender.dest1.immediateflush = true

! Write log to a file, roll the file instator output to the log file, roll back when reaching a size

# log4j.appender.dest2 = org.apache.log4j.rollingfileAppender

! This appender will only log message with priority equal to or higher Than

! The one specified here

# log4j.Appender.Dest2.threshold = Error

! Specify The File Name ($ {property_key} gets substitudeid with its value)

# Log4j.Appender.dest2.file = $ {java.home} /log4j.log

! Don't append, overwrite

# log4j.appender.dest2.append = false

! Control The Maximum Log File Size

# log4j.appender.dest2.maxfilesize = 100kb

! Keep Backup File (s) (Backups Will Be in filename.1, .2 etc.)

# log4j.Appender.Dest2.maxbackupindex = 2

Write log to a file, Roll The File Every Week Outputs to the log file, rollback weekly

# log4j.appender.dest3 = org.apache.log4j.dailyrollingFileAppender

Specify the file name

# log4j.Appender.Dest3.file = log4testlogging2.html

! Control The Maximum Log File Size

# log4j.Appender.Dest3.maxfilesize = 300kb

Rollover Log File At the Start of Each WEEK

# Log4j.Appender.Dest3.datepattern = '.' YYYY-WW

! ------------------------------------------------- ----------------------------!

"Configure appender layouts (log formats) and their options!

! ------------------------------------------------- ----------------------------!

Use Simple Log Format (E.G. Info - Your Log Message)

# log4j.Appender.Dest1.Layout = org.apache.log4j.simplelayout! Use a c printf style pattern to format log message

# log4j.appender.dest1.Layout = org.apache.log4j.patternlayout

! For a pattern layout, Specify THE PATTERN (Default IS% M% N Which IS Fastest)

# log4j.Appender.dest1.Layout.conversionPattern =% - 5P:% m% N

OR,

# log4j.Appender.dest1.Layout.conversionPattern =% - 5P% 6.10R [% T]% x (% F:% L) -% M% N

# log4j.Appender.dest2.Layout = Org.apache.log4j.patternlayout

# log4j.Appender.Dest2.Layout.conversionPattern = [% D {ISO8601}]% 5P% 6.6R [% T]% x (% f:% L) -% M% N

! Or, (The Pattern Below Will Slow Down Your App)

# log4j.Appender.Dest2.Layout.conversionPattern = [% D {YYYY-MM-DD HH: mm},% 6.6R]% - 5P [% T]% x (% F:% L) -% M% N

! Format log message in the form of an html table

# log4j.Appender.Dest3.Layout = org.apache.log4j.htmllayout

! Incrude Java File Name and Line Number (Default Is False)

# Log4j.Appender.Dest3.Layout.LocationInfo = True

! Set Tag (Default: log4j log message)</p> <p># Log4j.Appender.Dest3.Layout.title = my app log</p> <p>! ------------------------------------------------- ----------------------------!</p> <p>! Pattern Formats Glossary!</p> <p>! ------------------------------------------------- ----------------------------!</p> <p>!% n - newline!</p> <p>!% m - Your log message!</p> <p>!% P - Message Priority (Fatal, Error, Warn, Info, Debug or Custom)!</p> <p>!% R - Millisecs Since Program Started Running!</p> <p>! %% - Percent Sign in Output!</p> <p>! !! ----------------------- Some more clutter in Your log ------------------ -------!</p> <p>!% C - Name of Your Category (Logger),% C {2} Will Outputs Last Two Components!</p> <p>!% T - Name of current thread!</p> <p>!% x - Nested Diagnostic Context (NDC) (You Supply it!)!</p> <p>!!</p> <p>! ------------------------- Slow Performance Formats --------------------- -------!</p> <p>!% d - date and time, Also% D {ISO8601},% d {date},% d {absolute},!</p> <p>!% d {hh: mm: ss, sss},% d {DD MMM YYYYY HH: mm: SS, SSS} and so ON!</p> <p>!% l - shortcut for% F% L% C% M!</p> <p>!% F - Java Source File Name!</p> <p>!% L - Java Source Line Number!</p> <p>!% C - java class name,% c {1} Will Output The Last One Component!</p> <p>!% M - Java Method Name!</p> <p>!!</p> <p>! ----------------------------- Format Modifiers ----------------- --------------!</p> <p>!%-An_Letter_Above - Left-Justify In min. Width (Default Is Right-Justify)!</p> <p>!% 20any_Letter_above - 20 char. Min. Width (Pad with spaces if reqd.)!</p> <p>!% .30any_Letter_above - 30 char. Max. Width (Truncate Beginning if Reqd.)!</p> <p>!% -10.10R - EXAMPLE. Left-Justify Time Elapsed Within 10-Wide Field.!</p> <p>! Truncate from Beginning If Wider Than 10 Characters.!</p> <p>! ------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------! -------------------------------------------------- -------!</p> <p>! Options Glossary!</p> <p>! ------------------------------------------------- ----------------------------!</p> <p>! ------------------------- Overall Options for log4J -------------------- -------!</p> <p>! Specify as command line option: -dlog4j.defaultinitOverride = false</p> <p>! Specify as command line option: -dlog4j.configuration = app_config.properties</p> <p>! # Log4j.debug = TRUE</p> <p>! # Log4j.disable = info</p> <p>! # log4j.disableoverride = false</p> <p>! # Log4j.additivity.your.category.name = false</p> <p>!</p> <p>! ------------------------------------------- ----------!</p> <p>! # log4j.Appender.Dest1.threshold = info</p> <p>!</p> <p>! -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------!</p> <p>! # log4j.Appender.Dest1.threshold = info</p> <p>! # log4j.appender.dest1.immediateflush = true</p> <p>! # log4j.Appender.Dest1.target = system.err</p> <p>!</p> <p>! ----------------------------- FileAppender Options ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------!</p> <p>! # log4j.appender.dest2.threshold = info</p> <p>! # log4j.appender.dest2.immediateflush = true</p> <p>! # log4j.Appender.Dest2.file = mylog.txt</p> <p>! # log4j.Appender.Dest2.append = false</p> <p>!</p> <p>! ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---!</p> <p>! # log4j.appender.dest2.threshold = info</p> <p>! # log4j.appender.dest2.immediateflush = true</p> <p>! # log4j.Appender.Dest2.file = mylog.txt</p> <p>! # log4j.Appender.Dest2.append = false</p> <p>! # log4j.appender.dest2.maxfilesize = 100kb</p> <p>! # log4j.appender.dest2.maxbackupindex = 2</p> <p>!</p> <p>! ----------------------- DailyRollingFileAppender Options ----------------------!</p> <p>! # log4j.Appender.Dest2.threshold = info! # log4j.appender.dest2.immediateflush = true</p> <p>! # log4j.Appender.Dest2.file = mylog.txt</p> <p>! # log4j.Appender.Dest2.append = false</p> <p>! # log4j.Appender.Dest2.datepattern = '.' YYYY-WW</p> <p>!</p> <p>! ----------------------------- SimpleLayout Options ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------!</p> <p>** none **</p> <p>!</p> <p>! ------------ TTCCLAYOUT OPTIONS (PatternLayout is more flexible) -------------!</p> <p>! # log4j.Appender.Dest1.Layout.DateFormat = ISO8601</p> <p>! # log4j.Appender.Dest1.Layout.timezoneId = GMT-8: 00</p> <p>! # log4j.appender.dest1.Layout.categoryPrefixing = false</p> <p>! # Log4j.Appender.Dest1.Layout.threadprinting = false</p> <p>! # log4j.Appender.Dest1.Layout.Contextprinting = false</p> <p>!</p> <p>! ---------------------------- PatternLayout Options -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------!</p> <p>! # log4j.Appender.Dest1.Layout.conversionPattern =% m% N</p> <p>!</p> <p>! ------------------------------ HTMLLLAYOUT OPTIONS ------------------------------------------------------------------------------------------------------------------------------------------------------ ------------!</p> <p>! # log4j.Appender.Dest3.Layout.LocationInfo = TRUE</p> <p>! # log4j.Appender.Dest3.Layout.title = my App Title</p> <p>!</p> <p>! ------------------------------- XMLLayout Options --------------- -------------!</p> <p>! # log4j.Appender.Dest3.Layout.LocationInfo = TRUE</p> <p>! ------------------------------------------------- ----------------------------!</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-101238.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="101238" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.030</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'RmmQpgqwekndAvTCvRx2OW5NS_2Bj8CuEvMGReJnbrOUkg_2FPTXI5DiA9kBlMy17rAtRC_2FrOwl7RFaDV_2Fl0q4fylQ_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>