• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

I need help on a parameter I don't understand :(

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I HAVE to use a logging system for the people I'm working with, and I'm stuck with it
here is part of the doc


SystemLog

static void warn(java.lang.Class caller, java.lang.String line)
Write a warning line to the log.
static void warn(java.lang.Class caller, java.lang.Throwable t)
Write a warning line to the log.
static void write(java.lang.Class caller, java.lang.String line)
Write an informative line to the log.
static void write(java.lang.Class caller, java.lang.Throwable t)
Write an informative line to the log.


I don't know what to put in as the first parameter It can't be a Class.forName("") right?? Because that one required a try - catch block itself!
Do you know how I should use this logging system ?
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The class that is catching the exception should know what class that it is.
 
Ranch Hand
Posts: 1067
2
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you able to find another piece of code that calls this method? Your code can't be the only one using the method.
 
Dave Van Even
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is more from the docs Sorry I don't have ANY code that uses this

Class SystemLog
java.lang.Object
|
+--be.xxxx.common.logging.SystemLog
--------------------------------------------------------------------------------
public class SystemLog
extends java.lang.Object
Utility class: provide logging. This class shields clients from changes in the logging API that is used. It can use a third party logging API, an application server's logging capabilities or perhaps just write to standard out.
This version uses the Jakarta log4j logging library.
The order of severity is as follows:
debug: information useful for programmers, will not be logged in production state
informative: useful information on what's going on
warn: an operation encountered an unexpected condition but could continue
error: an operation failed and couldn't be continued
 
Cindy Glass
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have a logger class that has there 4 methods, and you want to call those methods from your class

Or am I missing the question here?

PS: jdk1.4 has a Logger class
 
Cindy Glass
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or you could just use
Class thisClass = this.getClass();
 
Dave Van Even
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's the one...
It worked!!!
Thanks alot!!
Dave
 
Dave Van Even
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
today I got the opertunity to ASK what parameter goes into
static void warn(java.lang.Class caller, java.lang.String line)
Write a warning line to the log.
and it's CLASSNAME.class ... !!!
I NEVER knew it existed! I mean. appearently EVERY class has a static field 'class' that is of type java.lang.Class !!
It's more a part of the Java language than the API.. so it's not there in the API.. I checked in java.lang.Object and nothing was there!
strange eh?
Dave
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The class named Class
 
You're not going crazy. You're going sane in a crazy word. Find comfort in this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic