|
0
|
1 |
package hirondelle.web4j.webmaster;
|
|
|
2 |
|
|
|
3 |
import hirondelle.web4j.model.AppException;
|
|
|
4 |
|
|
|
5 |
import java.util.Map;
|
|
|
6 |
|
|
|
7 |
/**
|
|
|
8 |
Configure the logging system used in your application.
|
|
|
9 |
|
|
|
10 |
<P>See {@link hirondelle.web4j.BuildImpl} for important information on how this item is configured.
|
|
|
11 |
{@link hirondelle.web4j.BuildImpl#forLoggingConfig()}
|
|
|
12 |
returns the configured implementation of this interface.
|
|
|
13 |
|
|
|
14 |
<P>Here, implementations configure the logging system using <em>code</em>, not a configuration file.
|
|
|
15 |
WEB4J itself uses JDK logging. Your application may also use JDK logging, or any other logging system.
|
|
|
16 |
|
|
|
17 |
<P>If your application does not require any logging config performed in code,
|
|
|
18 |
then just set the <tt>LoggingDirectory</tt> in <tt>web.xml</tt> set to <tt>'NONE'</tt>.
|
|
|
19 |
|
|
|
20 |
<P>Implementations of this interface are called by the framework only <em>once</em>, upon startup.
|
|
|
21 |
|
|
|
22 |
<P><b>Independent Logging On Servers</b><br>
|
|
|
23 |
In the JDK <tt>logging.properties</tt> config file, it is important to remember that
|
|
|
24 |
the <tt>handlers</tt> setting creates Handlers and <em>attaches them to the root logger</em>.
|
|
|
25 |
In general, those default handlers will be <em>shared</em> by all applications running
|
|
|
26 |
in that JRE. This is not appropriate for most server environments.
|
|
|
27 |
In a servlet environment, however, each application uses a <em>private class loader</em>.
|
|
|
28 |
This means that each application can perform its own custom logging
|
|
|
29 |
config in <em>code</em>, instead of in <tt>logging.properties</tt>, and <em>retain independence</em>
|
|
|
30 |
from other applications running in the same JRE.
|
|
|
31 |
*/
|
|
|
32 |
public interface LoggingConfig {
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
Configure application logging.
|
|
|
36 |
@param aConfig - in a servlet environment, this map will hold the <tt>init-param</tt> items for the servlet,
|
|
|
37 |
as stated in <tt>web.xml</tt>.
|
|
|
38 |
*/
|
|
|
39 |
void setup(Map<String, String> aConfig) throws AppException;
|
|
|
40 |
|
|
|
41 |
}
|