/** * Return a property for this event. The return value can be null. * * Equivalent to getMDC(String) in log4j 1.2. Provided * for compatibility with log4j 1.3. * * @param key property name * @return property value or null if property not set * @since 1.2.15 */ public final String getProperty(final String key) { Object value = getMDC(key); String retval = null; if (value != null) { retval = value.toString(); } return retval; }
private void writeObject(ObjectOutputStream oos) throws java.io.IOException { // Aside from returning the current thread name the wgetThreadName // method sets the threadName variable. this.getThreadName(); // This sets the renders the message in case it wasn't up to now. this.getRenderedMessage(); // This call has a side effect of setting this.ndc and // setting ndcLookupRequired to false if not already false. this.getNDC(); // This call has a side effect of setting this.mdcCopy and // setting mdcLookupRequired to false if not already false. this.getMDCCopy(); // This sets the throwable sting representation of the event throwable. this.getThrowableStrRep(); oos.defaultWriteObject(); // serialize this event's level writeLevel(oos); }
/** * Returns the set of the key values in the properties * for the event. * * The returned set is unmodifiable by the caller. * * Provided for compatibility with log4j 1.3 * * @return Set an unmodifiable set of the property keys. * @since 1.2.15 */ public Set getPropertyKeySet() { return getProperties().keySet(); }
/** * Set value for MDC property. * This adds the specified MDC property to the event. * Access to the MDC is not synchronized, so this * method should only be called when it is known that * no other threads are accessing the MDC. * @since 1.2.15 * @param propName * @param propValue */ public final void setProperty(final String propName, final String propValue) { if (mdcCopy == null) { getMDCCopy(); } if (mdcCopy == null) { mdcCopy = new Hashtable(); } mdcCopy.put(propName, propValue); }
private void readObject(ObjectInputStream ois) throws java.io.IOException, ClassNotFoundException { ois.defaultReadObject(); readLevel(ois); // Make sure that no location info is available to Layouts if(locationInfo == null) locationInfo = new LocationInfo(null, null); }
/** Return the message for this logging event. <p>Before serialization, the returned object is the message passed by the user to generate the logging event. After serialization, the returned value equals the String form of the message possibly after object rendering. @since 1.1 */ public Object getMessage() { if(message != null) { return message; } else { return getRenderedMessage(); } }
Object cracked = is.readObject(); if (cracked instanceof LogEvent) { keySet = ((LogEvent) cracked).getPropertyKeySet();
/** * Returns the set of properties * for the event. * * The returned set is unmodifiable by the caller. * * Provided for compatibility with log4j 1.3 * * @return Set an unmodifiable map of the properties. * @since 1.2.15 */ public Map getProperties() { getMDCCopy(); Map properties; if (mdcCopy == null) { properties = new HashMap(); } else { properties = mdcCopy; } return Collections.unmodifiableMap(properties); }
private void readObject(ObjectInputStream ois) throws java.io.IOException, ClassNotFoundException { ois.defaultReadObject(); readLevel(ois); // Make sure that no location info is available to Layouts if(locationInfo == null) { locationInfo = new LocationInfo(null, null); } }
/** Return the message for this logging event. <p>Before serialization, the returned object is the message passed by the user to generate the logging event. After serialization, the returned value equals the String form of the message possibly after object rendering. @since 1.1 */ public Object getMessage() { if(message != null) { return message; } else { return getRenderedMessage(); } }
Object cracked = is.readObject(); if (cracked instanceof LogEvent) { keySet = ((LogEvent) cracked).getPropertyKeySet();
private void writeObject(ObjectOutputStream oos) throws java.io.IOException { // Aside from returning the current thread name the wgetThreadName // method sets the threadName variable. this.getThreadName(); // This sets the renders the message in case it wasn't up to now. this.getRenderedMessage(); // This call has a side effect of setting this.ndc and // setting ndcLookupRequired to false if not already false. this.getNDC(); // This call has a side effect of setting this.mdcCopy and // setting mdcLookupRequired to false if not already false. this.getMDCCopy(); // This sets the throwable sting representation of the event throwable. this.getThrowableStrRep(); oos.defaultWriteObject(); // serialize this event's level writeLevel(oos); }
/** * Set value for MDC property. * This adds the specified MDC property to the event. * Access to the MDC is not synchronized, so this * method should only be called when it is known that * no other threads are accessing the MDC. * @since 1.2.15 * @param propName * @param propValue */ public final void setProperty(final String propName, final String propValue) { if (mdcCopy == null) { getMDCCopy(); } if (mdcCopy == null) { mdcCopy = new Hashtable(); } mdcCopy.put(propName, propValue); }
private void readObject(ObjectInputStream ois) throws java.io.IOException, ClassNotFoundException { ois.defaultReadObject(); readLevel(ois); // Make sure that no location info is available to Layouts if(locationInfo == null) locationInfo = new LocationInfo(null, null); }
/** * Returns the set of the key values in the properties * for the event. * * The returned set is unmodifiable by the caller. * * Provided for compatibility with log4j 1.3 * * @return Set an unmodifiable set of the property keys. * @since 1.2.15 */ public Set getPropertyKeySet() { return getProperties().keySet(); }
/** Return the message for this logging event. <p>Before serialization, the returned object is the message passed by the user to generate the logging event. After serialization, the returned value equals the String form of the message possibly after object rendering. @since 1.1 */ public Object getMessage() { if(message != null) { return message; } else { return getRenderedMessage(); } }
/** * Return a property for this event. The return value can be null. * * Equivalent to getMDC(String) in log4j 1.2. Provided * for compatibility with log4j 1.3. * * @param key property name * @return property value or null if property not set * @since 1.2.15 */ public final String getProperty(final String key) { Object value = getMDC(key); String retval = null; if (value != null) { retval = value.toString(); } return retval; }
Object cracked = is.readObject(); if (cracked instanceof LogEvent) { keySet = ((LogEvent) cracked).getPropertyKeySet();
private void writeObject(ObjectOutputStream oos) throws java.io.IOException { // Aside from returning the current thread name the wgetThreadName // method sets the threadName variable. this.getThreadName(); // This sets the renders the message in case it wasn't up to now. this.getRenderedMessage(); // This call has a side effect of setting this.ndc and // setting ndcLookupRequired to false if not already false. this.getNDC(); // This call has a side effect of setting this.mdcCopy and // setting mdcLookupRequired to false if not already false. this.getMDCCopy(); // This sets the throwable sting representation of the event throwable. this.getThrowableStrRep(); oos.defaultWriteObject(); // serialize this event's level writeLevel(oos); }
/** * Returns the set of properties * for the event. * * The returned set is unmodifiable by the caller. * * Provided for compatibility with log4j 1.3 * * @return Set an unmodifiable map of the properties. * @since 1.2.15 */ public Map getProperties() { getMDCCopy(); Map properties; if (mdcCopy == null) { properties = new HashMap(); } else { properties = mdcCopy; } return Collections.unmodifiableMap(properties); }