Package org.apache.avalon.framework.logger

Examples of org.apache.avalon.framework.logger.ConsoleLogger


      File primordialLogConfigFile = new File(logConfigDir + logConfigFilename);

      if (primordialLogConfigFile.exists())
      {
        //Continue with logkit configuration         
        primordialLoggerManager = new LogKitLoggerManager(null, new Hierarchy(), new ConsoleLogger(
                ConsoleLogger.LEVEL_INFO));
      }
      else
      {
        System.err.println("Logkit config file " + logConfigDir + logConfigFilename
View Full Code Here


     * @return true if the file contains the string, false otherwise.
     * @throws IOException
     */
    public static boolean containsPattern(File file, Pattern pattern) throws IOException {
       
        Logger log = new ConsoleLogger();

        FileChannel fc = null;
    // Open the file and then get a channel from the stream
        FileInputStream fis = null;
    boolean result = false;

    try {
      fis = new FileInputStream(file);
      fc = fis.getChannel();

      // Get the file's size and then map it into memory
      int sz = (int)fc.size();
      MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);

      // Decode the file into a char buffer
      CharBuffer cb = decoder.decode(bb);

      // Perform the search
      Matcher pm = pattern.matcher(cb); // Pattern matcher

      result = pm.find();
    } catch (FileNotFoundException e) {
      log.error("File not found: " +e.toString());
    } catch (CharacterCodingException e) {
      log.error("Problem with encoding: " +e.toString());
    } catch (IOException e) {
      log.error("IO Exception: " +e.toString());
    } finally {
          // Close the channel and the stream
          if (fc != null)
              fc.close();
          if (fis != null)
View Full Code Here

     * (i.e. the groupth group of the match)
     * @throws IOException if the file could not be read.
     */
    public static String[] findPattern(File file, Pattern pattern, int group) throws IOException {

        Logger log = new ConsoleLogger();

        ArrayList occurences = new ArrayList();
        FileInputStream fis = null;
        FileChannel fc = null;

        try {
            // Open the file and then get a channel from the stream
            fis = new FileInputStream(file);
            fc = fis.getChannel();

            // Get the file's size and then map it into memory
            int sz = (int)fc.size();
            MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);

            // Decode the file into a char buffer
            CharBuffer cb = decoder.decode(bb);

            // Perform the search
            Matcher pm = pattern.matcher(cb); // Pattern matcher

            while (pm.find()) {
                occurences.add(pm.group(group));
            }
        } catch (FileNotFoundException e) {
            log.error("file not found " +e.toString());
        } catch (CharacterCodingException e) {
            log.error("encoding problem " +e.toString());
        } catch (IOException e) {
            log.error("IO exception" +e.toString());
        } finally {
          // Close the channel and the stream
          if (fc != null)
              fc.close();
          if (fis != null)
View Full Code Here

        suite.addTestSuite(AvalonLoggerTestCase.class);
        return suite;
    }

    public Log getLogObject() {
        Log log = new AvalonLogger(new ConsoleLogger());
    return log;
  }
View Full Code Here

            driver.setErrorDump(true);
        }

        // Nov 18, 02  eliminates spurious [ERROR] message to logger
       
        driver.setLogger (new ConsoleLogger(ConsoleLogger.LEVEL_INFO)) ;
        log.info (Version.getVersion()) ;

        XMLReader parser = inputHandler.getParser();

        PrinterJob pj = PrinterJob.getPrinterJob();
View Full Code Here

        log = logger;
    }

    private Logger getLogger() {
        if(log == null) {
            log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
            log.error("Logger not set");
        }

        return log;
    }
View Full Code Here

    private Logger log;

    public CommandLineOptions(String[] args)
            throws FOPException, FileNotFoundException {

        setLogger(new ConsoleLogger(ConsoleLogger.LEVEL_INFO));

        boolean optionsParsed = true;
        rendererOptions = new java.util.HashMap();
        try {
            optionsParsed = parseOptions(args);
View Full Code Here

     */
    private boolean parseOptions(String args[]) throws FOPException {
        for (int i = 0; i < args.length; i++) {
            if (args[i].equals("-d") || args[i].equals("--full-error-dump")) {
                errorDump = Boolean.TRUE;
                setLogger(new ConsoleLogger(ConsoleLogger.LEVEL_DEBUG));
            } else if (args[i].equals("-x")
                       || args[i].equals("--dump-config")) {
                dumpConfiguration = Boolean.TRUE;
            } else if (args[i].equals("-q") || args[i].equals("--quiet")) {
                quiet = Boolean.TRUE;
                setLogger(new ConsoleLogger(ConsoleLogger.LEVEL_ERROR));
            } else if (args[i].equals("-c")) {
                if ((i + 1 == args.length)
                        || (args[i + 1].charAt(0) == '-')) {
                    throw new FOPException("if you use '-c', you must specify the name of the configuration file");
                } else {
View Full Code Here

        renderer = new AWTRenderer(resource);
        frame = createPreviewDialog(renderer, resource);
        renderer.setProgressListener(frame);
        renderer.setComponent(frame);
        driver = new Driver();
        driver.setLogger(new ConsoleLogger(ConsoleLogger.LEVEL_INFO));
        if (errorDump) {
            driver.setErrorDump(true);
        }
        driver.setRenderer(renderer);
        // init parser
View Full Code Here

    public TestConverter() {
        setupLogging();
    }

    private void setupLogging() {
        log = new ConsoleLogger(ConsoleLogger.LEVEL_ERROR);
        MessageHandler.setScreenLogger(log)
    }
View Full Code Here

TOP

Related Classes of org.apache.avalon.framework.logger.ConsoleLogger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.