ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/core/loggers/MultiLogger.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/core/loggers/MultiLogger.java (file contents):
Revision 1.2 by ajm, Wed Nov 29 21:27:25 2000 UTC vs.
Revision 1.4 by tdb, Mon Jan 22 21:29:17 2001 UTC

# Line 2 | Line 2
2   package uk.ac.ukc.iscream.core.loggers;
3  
4   //---IMPORTS---
5 < import uk.ac.ukc.iscream.core.LoggerImpl;
6 < import uk.ac.ukc.iscream.core.Logger;
5 > import uk.ac.ukc.iscream.util.*;
6 > import uk.ac.ukc.iscream.core.*;
7   import java.io.IOException;
8  
9   /**
# Line 13 | Line 13 | import java.io.IOException;
13   * @author  $Author$
14   * @version $Id$
15   */
16 < class MultiLogger implements LoggerImpl {
16 > public class MultiLogger implements LoggerImpl {
17  
18   //---FINAL ATTRIBUTES---
19  
# Line 30 | Line 30 | class MultiLogger implements LoggerImpl {
30       * Creates a new MultiLogger.
31       */
32      public MultiLogger() throws IOException {
33 <        _screenlog = new ScreenLogger();
34 <        _filelog = new FileLogger();
35 <        write(this.toString(), Logger.SYSINIT, "started");
33 >        _screenlog = new ScreenLogger();
34 >        _filelog = new FileLogger();
35 >        write(toString(), Logger.SYSINIT, "started");
36      }
37  
38   //---PUBLIC METHODS---
39  
40      /**
41 <         * The write() method takes a message, formats it using the
42 <         * formatLogLine() method, and then outputs it to the screen
43 <         * using System.out.println(). The source is usually the
44 <         * calling object, referenced by `this'. The method has been
45 <         * made synchronized to avoid it being called by two different
46 <         * objects and the output ending up merged on the screen.
47 <         *
48 <         * @param source A string representation of the calling object.
49 <         * @param verbosity the verbosity of this message
50 <         * @param message The text to be logged.
51 <         */  
41 >     * The write() method takes a message, formats it using the
42 >     * formatLogLine() method, and then outputs it to the screen
43 >     * using System.out.println(). The source is usually the
44 >     * calling object, referenced by `this'. The method has been
45 >     * made synchronized to avoid it being called by two different
46 >     * objects and the output ending up merged on the screen.
47 >     *
48 >     * @param source A string representation of the calling object.
49 >     * @param verbosity the verbosity of this message
50 >     * @param message The text to be logged.
51 >     */  
52      public synchronized void write(String source, int verbosity, String message) {
53          _screenlog.write(source, verbosity, message);
54          _filelog.write(source, verbosity, message);
# Line 58 | Line 58 | class MultiLogger implements LoggerImpl {
58       * Overrides the {@link java.lang.Object#toString() Object.toString()}
59       * method to provide clean logging (every class should have this).
60       *
61 +     * This uses the uk.ac.ukc.iscream.util.FormatName class
62 +     * to format the toString()
63 +     *
64       * @return the name of this class and its CVS revision
65       */
66      public String toString() {
67 <        return this.getClass().getName() + "(" + REVISION.substring(11, REVISION.length() - 2) + ")";
67 >        return FormatName.getName(
68 >            _name,
69 >            getClass().getName(),
70 >            REVISION);
71      }
72 +    
73   //---PRIVATE METHODS---
74  
75   //---ACCESSOR/MUTATOR METHODS---
76  
77   //---ATTRIBUTES---
78  
79 <        /**
80 <         * A reference to the ScreenLogger we'll use
81 <         */
82 <        private LoggerImpl _screenlog;
83 <        
84 <        /**
85 <         * A reference to the FileLogger we'll use
86 <         */
87 <        private LoggerImpl _filelog;
79 >    /**
80 >     * A reference to the ScreenLogger we'll use
81 >     */
82 >    private LoggerImpl _screenlog;
83 >    
84 >    /**
85 >     * A reference to the FileLogger we'll use
86 >     */
87 >    private LoggerImpl _filelog;
88 >    
89 >    /**
90 >     * This is the friendly identifier of the
91 >     * component this class is running in.
92 >     * eg, a Filter may be called "filter1",
93 >     * If this class does not have an owning
94 >     * component,  a name from the configuration
95 >     * can be placed here.  This name could also
96 >     * be changed to null for utility classes.
97 >     */
98 >    private String _name = Core.NAME;
99      
100   //---STATIC ATTRIBUTES---
101      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines