<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Take a look at XLogger in slf4j-ext.<div><br></div><div>Out of curiosity, what do you need the wrapper for?</div><div><br></div>Ralph</div><div><br></div><div>On Feb 20, 2009, at 2:58 PM, Ashley Westwell wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="font: normal normal normal 10pt/normal Tahoma, Verdana, sans-serif; "><div>Good Afternoon<br><br>I have created a wrapper layer for SLF4J (Listed below). However the line number are incorrect, it is using the line numbers in the wrapper class not the class that I called the wrapper from. What is the correct way to fix this?<br><br>package com.test.commons.logging;<br><br>import com.test.commons.logging.LoggerFactory.LEVEL;<br><br>public class Logger {<br><br>&nbsp;&nbsp;&nbsp; private LEVEL infoLevel = LEVEL.FINE;<br>&nbsp;&nbsp;&nbsp; private LEVEL debugLevel = LEVEL.FINE;<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; private org.slf4j.Logger logger = null;<br><br>&nbsp;&nbsp;&nbsp; public Logger(Class clazz, LEVEL infoLevel, LEVEL debugLevel) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this.infoLevel = infoLevel;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this.debugLevel = debugLevel;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger = org.slf4j.LoggerFactory.getLogger(clazz);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public Logger(String name, LEVEL infoLevel, LEVEL debugLevel) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this.infoLevel = infoLevel;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; this.debugLevel = debugLevel;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger = org.slf4j.LoggerFactory.getLogger(name);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void info(String message) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.info(message);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void info(String message, Throwable throwable) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.info(message, throwable);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void info(String message, Object[] objects) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(logger.isInfoEnabled()) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.info(message, objects);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void info(LEVEL level, String message) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if((logger.isInfoEnabled()) &amp;&amp; (level.ordinal() &lt;= infoLevel.ordinal())) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.info(message);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void info(LEVEL level, String message, Throwable throwable) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if((logger.isInfoEnabled()) &amp;&amp; (level.ordinal() &lt;= infoLevel.ordinal())) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.info(message, throwable);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void info(LEVEL level, String message, Object[] objects) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if((logger.isInfoEnabled()) &amp;&amp; (level.ordinal() &lt;= infoLevel.ordinal())) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.info(message, objects);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; // Debug messages.<br>&nbsp;&nbsp;&nbsp; public void debug(String message) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(logger.isDebugEnabled()) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.debug(message);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; public void debug(String message, Throwable throwable) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(logger.isDebugEnabled()) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.debug(message, throwable);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void debug(String message, Object[] objects) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(logger.isDebugEnabled()) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.debug(message, objects);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void debug(LEVEL level, String message) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if((logger.isDebugEnabled()) &amp;&amp; (level.ordinal() &lt;= debugLevel.ordinal())) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.debug(message);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void debug(LEVEL level, String message, Throwable throwable) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if((logger.isDebugEnabled()) &amp;&amp; (level.ordinal() &lt;= debugLevel.ordinal())) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.debug(message, throwable);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; public void debug(LEVEL level, String message, Object[] objects) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if((logger.isDebugEnabled()) &amp;&amp; (level.ordinal() &lt;= debugLevel.ordinal())) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.debug(message, objects);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; // The highest value; intended for extremely important messages (e.g. fatal program errors).<br>&nbsp;&nbsp;&nbsp; public void severe(String message) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(logger.isErrorEnabled()) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.error(message);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void severe(String message, Throwable throwable) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(logger.isErrorEnabled()) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.error(message, throwable);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void severe(String message, Object[] objects) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(logger.isErrorEnabled()) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.error(message, objects);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; // Intended for warning messages.<br>&nbsp;&nbsp;&nbsp; public void warning(String message) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(logger.isWarnEnabled()) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.warn(message);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void warning(String message, Throwable throwable) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(logger.isWarnEnabled()) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.warn(message, throwable);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>&nbsp;&nbsp;&nbsp; public void warning(String message, Object[] objects) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(logger.isWarnEnabled()) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; logger.warn(message, objects);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;<span class="Apple-converted-space">&nbsp;</span><br>}</div><br><br><hr><br>Notice:&nbsp;This&nbsp;email&nbsp;is&nbsp;confidential.&nbsp;&nbsp;If&nbsp;you&nbsp;are&nbsp;not&nbsp;the&nbsp;intended&nbsp;recipient,&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;by&nbsp;return&nbsp;email&nbsp;and&nbsp;delete&nbsp;this&nbsp;message&nbsp;from&nbsp;your&nbsp;mail&nbsp;box&nbsp;without&nbsp;reading&nbsp;or&nbsp;copying&nbsp;it&nbsp;or&nbsp;any&nbsp;attachments.<br><br>Attention:&nbsp;Ce&nbsp;courriel&nbsp;est&nbsp;confidentiel.&nbsp;Si&nbsp;vous&nbsp;n'êtes&nbsp;pas&nbsp;le&nbsp;destinataire&nbsp;prévu,&nbsp;veuillez&nbsp;en&nbsp;informer&nbsp;l'expéditeur&nbsp;par&nbsp;le&nbsp;courriel&nbsp;de&nbsp;retour&nbsp;et&nbsp;le&nbsp;supprimer&nbsp;immédiatement&nbsp;sans&nbsp;le&nbsp;lire&nbsp;ou&nbsp;le&nbsp;copier&nbsp;(incluant&nbsp;les&nbsp;pièces&nbsp;jointes,&nbsp;&nbsp;le&nbsp;cas&nbsp;échéant).<br>_______________________________________________<br>dev mailing list<br><a href="mailto:dev@slf4j.org">dev@slf4j.org</a><br><a href="http://www.slf4j.org/mailman/listinfo/dev">http://www.slf4j.org/mailman/listinfo/dev</a></div></span></blockquote></div><br></body></html>