I'm converting my desktop application to an applet.  Due to browser
security, I can't read or write local files so I can neither use .properties
nor write logs.  My dilemma is rooted in reusable classes.  My desktop
application(now applet) uses some classes, such as a timeStamp class, that
are also used in my server.  I'd prefer to retain that class's logging
capability when it is running in the server, but disable the logging when
running in the applet.

I see 3 alternatives:
1. move the logger instantiation to the constructor, then pass the
constructor a newly created boolean indicating whether it's running as an
applet.
2. subclass Logger, then have the subclass check some global boolean
indicating whether it's running as an applet
3. remove logging from the reused classes altogether

I don't like any of these alternatives and wondered if there is another,
more appealing alternative.  Here's a simple example that illustrates my
problem.

Thanks

Jeff

public class TimeStamp implements Serializable {

// the following line will cause a security exception
    static Logger                         cat              =
Logger.getLogger( "TimeStamp" );

   public TimeStamp( long milliSeconds ) {

   }
}

Reply via email to