ApplicationTer.java

import java.io.*;
import java.util.logging.*;
public class ApplicationTer {
  final static Logger logger = Logger.getLogger("application");
  final static Logger admlogger = Logger.getLogger("application.adm");
  final static Logger eleclogger = Logger.getLogger("application.elec");
  public static void main(String[] args) throws IOException {
    try {
      // Logger général
      Handler h = new FileHandler("%t/application.log");
      logger.addHandler(h);
      h = new FileHandler("%t/application.inges.log");
      h.setLevel(MonFiltre.NIVEAU_INGE_RESEAU);
      logger.addHandler(h);
      // Les logs pour l'électricien
      h = new FileHandler("%t/application.electricien.log");
      eleclogger.addHandler(h);
      // Les logs pour les administrateurs
      h = new FileHandler("%t/application.adminReseau.log");
      h.setLevel(MonFiltre.NIVEAU_ADMIN_RESEAU);
      admlogger.addHandler(h);
      h = new FileHandler("%t/application.adminSysteme.log");
      h.setFilter(new FiltreAdmSystem());
      admlogger.addHandler(h);
      //
      logger.log(MonFiltre.NIVEAU_EXPERT,"Application démarrée");
      // ...
    } catch (Exception e) {
      logger.log(MonFiltre.NIVEAU_EXPERT,"Problème application: ", e);
      // ...
    }
    logger.log(MonFiltre.NIVEAU_EXPERT,"Application terminée");
  }
}