<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html;charset=iso-8859-1'>
<style>BODY{font:10pt Tahoma, Verdana, sans-serif;}</style>
</head>
<body>
<DIV>Hey Ralph</DIV>
<DIV> </DIV>
<DIV>Took a look at the call and the wrapper class. My issue I dont want to esxpose the methods defined in the Logger interface. I only want to expose my methods for logging. Thats why I did not implement the Logger interface. Can you suggest how I could deal with the line number issue with out implementing Logger?</DIV>
<DIV> </DIV>
<DIV>Thanks</DIV><BR>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<HR>
<B>From:</B> Ralph Goers [mailto:rgoers@apache.org]<BR><B>To:</B> slf4j developers list [mailto:dev@slf4j.org]<BR><B>Sent:</B> Fri, 20 Feb 2009 17:44:38 -0500<BR><B>Subject:</B> Re: [slf4j-dev] SLF4J Wrapper class line number incorrect<BR><BR>
<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="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; orphans: 2; widows: 2; -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: 10pt 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> private LEVEL infoLevel = LEVEL.FINE;<BR> private LEVEL debugLevel = LEVEL.FINE;<BR> <SPAN class=Apple-converted-space> </SPAN><BR> private org.slf4j.Logger logger = null;<BR><BR> public Logger(Class clazz, LEVEL infoLevel, LEVEL debugLevel) {<BR> this.infoLevel = infoLevel;<BR> this.debugLevel = debugLevel;<BR> logger = org.slf4j.LoggerFactory.getLogger(clazz);<BR> <SPAN class=Apple-converted-space> </SPAN><BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public Logger(String name, LEVEL infoLevel, LEVEL debugLevel) {<BR> this.infoLevel = infoLevel;<BR> this.debugLevel = debugLevel;<BR> logger = org.slf4j.LoggerFactory.getLogger(name);<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void info(String message) {<BR> logger.info(message);<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void info(String message, Throwable throwable) {<BR> logger.info(message, throwable);<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void info(String message, Object[] objects) {<BR> if(logger.isInfoEnabled()) {<BR> logger.info(message, objects);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void info(LEVEL level, String message) {<BR> if((logger.isInfoEnabled()) && (level.ordinal() <= infoLevel.ordinal())) {<BR> logger.info(message);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void info(LEVEL level, String message, Throwable throwable) {<BR> if((logger.isInfoEnabled()) && (level.ordinal() <= infoLevel.ordinal())) {<BR> logger.info(message, throwable);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void info(LEVEL level, String message, Object[] objects) {<BR> if((logger.isInfoEnabled()) && (level.ordinal() <= infoLevel.ordinal())) {<BR> logger.info(message, objects);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> // Debug messages.<BR> public void debug(String message) {<BR> if(logger.isDebugEnabled()) {<BR> logger.debug(message);<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> }<BR> public void debug(String message, Throwable throwable) {<BR> if(logger.isDebugEnabled()) {<BR> logger.debug(message, throwable);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void debug(String message, Object[] objects) {<BR> if(logger.isDebugEnabled()) {<BR> logger.debug(message, objects);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void debug(LEVEL level, String message) {<BR> if((logger.isDebugEnabled()) && (level.ordinal() <= debugLevel.ordinal())) {<BR> logger.debug(message);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void debug(LEVEL level, String message, Throwable throwable) {<BR> if((logger.isDebugEnabled()) && (level.ordinal() <= debugLevel.ordinal())) {<BR> logger.debug(message, throwable);<BR> }<BR> }<BR><BR> public void debug(LEVEL level, String message, Object[] objects) {<BR> if((logger.isDebugEnabled()) && (level.ordinal() <= debugLevel.ordinal())) {<BR> logger.debug(message, objects);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> // The highest value; intended for extremely important messages (e.g. fatal program errors).<BR> public void severe(String message) {<BR> if(logger.isErrorEnabled()) {<BR> logger.error(message);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void severe(String message, Throwable throwable) {<BR> if(logger.isErrorEnabled()) {<BR> logger.error(message, throwable);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void severe(String message, Object[] objects) {<BR> if(logger.isErrorEnabled()) {<BR> logger.error(message, objects);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> // Intended for warning messages.<BR> public void warning(String message) {<BR> if(logger.isWarnEnabled()) {<BR> logger.warn(message);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void warning(String message, Throwable throwable) {<BR> if(logger.isWarnEnabled()) {<BR> logger.warn(message, throwable);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR> public void warning(String message, Object[] objects) {<BR> if(logger.isWarnEnabled()) {<BR> logger.warn(message, objects);<BR> }<BR> }<BR> <SPAN class=Apple-converted-space> </SPAN><BR>}</DIV><BR><BR>
<HR>
<BR>Notice: This email is confidential. If you are not the intended recipient, please notify the sender by return email and delete this message from your mail box without reading or copying it or any attachments.<BR><BR>Attention: Ce courriel est confidentiel. Si vous n'êtes pas le destinataire prévu, veuillez en informer l'expéditeur par le courriel de retour et le supprimer immédiatement sans le lire ou le copier (incluant les pièces jointes, le cas é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></BLOCKQUOTE>
<STYLE>
* {word-wrap:break-word;-webkit-nbsp-mode:space;-webkit-line-break:after-white-space;;}
</STYLE>
<DIV> </DIV>
<DIV> </DIV><BR />
<BR />
<HR />
<BR />
Notice: This email is confidential. If you are not the intended recipient, please notify the sender by return email and delete this message from your mail box without reading or copying it or any attachments.<BR />
<BR />
Attention: Ce courriel est confidentiel. Si vous n'êtes pas le destinataire prévu, veuillez en informer l'expéditeur par le courriel de retour et le supprimer immédiatement sans le lire ou le copier (incluant les pièces jointes, le cas échéant).<BR />
</body></html>