logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Thielen" <da...@windward.net>
Subject Asking again: Trying to write a J# log wrapper - mostly there
Date Wed, 21 Sep 2005 03:10:27 GMT
Hi;

Is there someone out there who knows log4net well enough to answer this? I'd
like to get this complete so I can then offer it to the jakarta logging
group - I think other J# developers could use this.

Or somewhere else I should ask?

Thanks - dave


-----Original Message-----
From: David Thielen [mailto:david@windward.net] 
Sent: Monday, September 19, 2005 9:43 AM
To: 'Log4NET User'
Subject: RE: Trying to write a J# log wrapper - mostly there

Hi;

I think this is the same thing - giving the filename/line number of the
Logger.jsl wrapper instead of the calling method.

??? - thanks - dave


-----Original Message-----
From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Sent: Friday, September 16, 2005 2:27 PM
To: Log4NET User
Subject: RE: Trying to write a J# log wrapper - mostly there

Here's the VS2003 solution for those that are interested:

 http://www.ronosaurus.com/log4net/2005-09-16_JSharpWrapper_VS2003.zip

I play with it more over the weekend. This solution doesn't feel very
elegant. I wonder if there isn't a better way to go about solvin the
problem...

--- David Thielen <david@windward.net> wrote:

> Yep - that's it.
> 
> What I want to have happen is for the output right after "between",
> where it
> is called from my Logger.jsl to be identical to the first output
> (except for
> the line number).
> 
> So that the logging gives the file/line that called my log.error()
> rather
> than the file/line in Logger.jsl.
> 
> Does that make sense?
> 
> Thanks - dave
> 
> 
> -----Original Message-----
> From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
> Sent: Friday, September 16, 2005 1:51 PM
> To: Log4NET User
> Subject: RE: Trying to write a J# log wrapper - mostly there
> 
> I'm not using VS2005 :(
> 
> I changed the project over to VS2003 and was able to generate this
> screen shot:
> 
>  http://www.ronosaurus.com/log4net/2005-09-16_jsharp_and_log4net.png
> 
> Does that exhibit the behavior your experiencing? Should there not be
> question marks for the last two messages?
> 
> --- David Thielen <david@windward.net> wrote:
> 
> > Hi;
> > 
> > I put the zip file up on http://www.windward.net/log4j4net.ZIP -
> > anyone is
> > welcome to look at it, I'm giving it to the apache logging group if
> > they
> > want it once I'm done.
> > 
> > Look for the bugbug comments. Also, there is a project
> > WindwardReports in
> > the solution, but I did not include it as it's not needed. So just
> > delete
> > that project.
> > 
> > Thanks - dave
> > 
> > 
> > -----Original Message-----
> > From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
> > Sent: Friday, September 16, 2005 12:49 PM
> > To: Log4NET User
> > Subject: Re: Trying to write a J# log wrapper - mostly there
> > 
> > Unless someone has a better idea, I think your best bet is to make
> a
> > very very simple J# console app that demonstrates your problem and
> > make
> > it available for download somewhere (or email me off list) so we
> can
> > play around with it. Perhaps zip containing a directory with the
> > necessary files and the .sln file? Don't forget to include the
> > necessary .jar files (log4j.jar ???)
> > 
> > --- David Thielen <david@windward.net> wrote:
> > 
> > > Hi;
> > > 
> > >  
> > > 
> > > I am writing a J# wrapper around log4net. I am doing this by
> > > implementing
> > > the public classes in log4j using it's package/names so my java
> > code
> > > is
> > > common source between java and J#.
> > > 
> > >  
> > > 
> > > I have it working except it uses the file name & line number from
> > my
> > > Logger.jsl instead of the app that calls my logger.
> > > 
> > >  
> > > 
> > > I can't inherit from LoggerWrapperImpl because that is a C#
> class.
> > > (Would be
> > > cool if you could do that.)
> > > 
> > >  
> > > 
> > > So I did the following:
> > > 
> > >  
> > > 
> > > public class Logger
> > > 
> > > {
> > > 
> > >       private log4net.ILog log;
> > > 
> > >       private Logger(Class appClass)
> > > 
> > >       {
> > > 
> > >             log =
> > > log4net.LogManager.GetLogger(Class.ToType(appClass));
> > > 
> > >       }
> > > 
> > >       public void error(Object message)
> > > 
> > >       {
> > > 
> > >             log.Error(message);
> > > 
> > >       }
> > > 
> > > }
> > > 
> > >  
> > > 
> > > Which works fine, but has the filename/line number problem. So I
> > then
> > > tried:
> > > 
> > >       public void error(Object message)
> > > 
> > >       {
> > > 
> > >             ((log4net.Core.LogImpl)log).get_Logger().Log(type,
> > > log4net.Core.Level.Error, "again" + message, null);
> > > 
> > >       }
> > > 
> > >  
> > > 
> > > Which gave the app domain as the filename and 0 as the line
> number.
> > > 
> > >  
> > > 
> > > So...
> > > 
> > >  
> > > 
> > > Any suggestions on what to try next?
> > > 
> > >  
> > > 
> > > Thanks - dave
> > > 
> > >  
> > > 
> > > 
> > 
> > 
> > 
> 
> 
> 
> 






Mime
View raw message