org.apache.log4j.varia
Class SoundAppender
java.lang.Object
|
+--org.apache.log4j.spi.ComponentBase
|
+--org.apache.log4j.AppenderSkeleton
|
+--org.apache.log4j.varia.SoundAppender
- All Implemented Interfaces:
- Appender, Component, OptionHandler
- public final class SoundAppender
- extends AppenderSkeleton
Plays a sound clip created using Applet.newAudioClip when an event is received.
If the audio format is not supported, a message stating the SoundAppender could
not be initialized is logged.
Use a filter in combination with this appender to control when the appender is
triggered.
For example, in the appender definition, include a LevelMatchFilter configured
to accept WARN or greater, followed by a DenyAllFilter.
- Author:
- Scott Deboy
Method Summary |
void |
activateOptions()
Attempt to initialize the appender by creating a reference to an AudioClip. |
protected void |
append(LoggingEvent event)
Play the sound if an event is being processed |
void |
close()
Release any resources allocated within the appender such as file handles,
network connections, etc. |
String |
getAudioURL()
Accessor |
boolean |
requiresLayout()
Gets whether appender requires a layout. |
void |
setAudioURL(String audioURL)
Mutator - common format for a file-based url:
file:///c:/path/someaudioclip.wav |
Methods inherited from class org.apache.log4j.AppenderSkeleton |
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isActive, isAsSevereAsThreshold, isAsSevereAsThreshold, isClosed, setErrorHandler, setLayout, setName, setThreshold |
SoundAppender
public SoundAppender()
activateOptions
public void activateOptions()
- Attempt to initialize the appender by creating a reference to an AudioClip.
Will log a message if format is not supported, file not found, etc.
- Overrides:
activateOptions
in class AppenderSkeleton
getAudioURL
public final String getAudioURL()
- Accessor
- Returns:
- audio file
setAudioURL
public void setAudioURL(String audioURL)
- Mutator - common format for a file-based url:
file:///c:/path/someaudioclip.wav
- Parameters:
audioURL
-
append
protected void append(LoggingEvent event)
- Play the sound if an event is being processed
- Overrides:
append
in class AppenderSkeleton
close
public void close()
- Description copied from interface:
Appender
- Release any resources allocated within the appender such as file handles,
network connections, etc.
It is a programming error to append to a closed appender.
requiresLayout
public boolean requiresLayout()
- Gets whether appender requires a layout.
- Returns:
- false
Copyright © 2000-2006 Apache Software Foundation.
Licensed under the Apache License, Version 2.0.