1 17 package org.apache.log; 18 19 import java.io.ObjectStreamException ; 20 import java.io.Serializable ; 21 22 30 public final class LogEvent 31 implements Serializable 32 { 33 private static final long START_TIME = System.currentTimeMillis(); 35 36 private String m_category; 38 39 private String m_message; 41 42 private Throwable m_throwable; 44 45 private long m_time; 47 48 private Priority m_priority; 50 51 private ContextMap m_contextMap; 53 54 59 public final Priority getPriority() 60 { 61 return m_priority; 62 } 63 64 69 public final void setPriority( final Priority priority ) 70 { 71 m_priority = priority; 72 } 73 74 79 public final ContextMap getContextMap() 80 { 81 return m_contextMap; 82 } 83 84 89 public final void setContextMap( final ContextMap contextMap ) 90 { 91 m_contextMap = contextMap; 92 } 93 94 99 public final String getCategory() 100 { 101 return m_category; 102 } 103 104 109 public final String getMessage() 110 { 111 return m_message; 112 } 113 114 119 public final Throwable getThrowable() 120 { 121 return m_throwable; 122 } 123 124 129 public final long getTime() 130 { 131 return m_time; 132 } 133 134 139 public final long getRelativeTime() 140 { 141 return m_time - START_TIME; 142 } 143 144 149 public final void setCategory( final String category ) 150 { 151 m_category = category; 152 } 153 154 159 public final void setMessage( final String message ) 160 { 161 m_message = message; 162 } 163 164 169 public final void setThrowable( final Throwable throwable ) 170 { 171 m_throwable = throwable; 172 } 173 174 179 public final void setTime( final long time ) 180 { 181 m_time = time; 182 } 183 184 190 private Object readResolve() 191 throws ObjectStreamException 192 { 193 if( null == m_category ) 194 { 195 m_category = ""; 196 } 197 if( null == m_message ) 198 { 199 m_message = ""; 200 } 201 202 String priorityName = ""; 203 if( null != m_priority ) 204 { 205 priorityName = m_priority.getName(); 206 } 207 208 m_priority = Priority.getPriorityForName( priorityName ); 209 210 return this; 211 } 212 } 213 | Popular Tags |