Каталог статей
Меню сайта


Форма входа


Категории раздела
WebLogic administration and programming [7]
JSF and Primefaces [1]
Java general programming [12]
Other Java problems [11]
JPA and Hibernate [2]
Spring [2]
Spring


Поиск


Друзья сайта
  • Официальный блог
  • Сообщество uCoz
  • FAQ по системе
  • Инструкции для uCoz


  • Статистика

    Онлайн всего: 1
    Гостей: 1
    Пользователей: 0


    Приветствую Вас, Гость · RSS 20.05.2024, 13:38
    Главная » Статьи » Java » WebLogic administration and programming

    Logging adapter for WebLogic

    https://docs.oracle.com/cd/E23943_01/web.1111/e13739/logging_services.htm#WLLOG199

    To redirect messages from JDK logging system to WebLogic standard log files we need to add special ServletLoggingHandler.

    logging.properties:

    # Specify the handlers to create in the root logger
    handlers = weblogic.logging.ServerLoggingHandler
    
    # Register handlers for the com.foo.toyshop and its child loggers
    com.foo.toyshop.handlers = java.util.logging.ConsoleHandler, weblogic.logging.ServerLoggingHandler
     
    # Do not send the toyshop log messages to the root handler
    com.foo.toyshop.useParentHandlers = false
     
    # Set the default logging level for the root logger
    .level = ALL
     
    # Set the default logging level for new ConsoleHandler instances
    java.util.logging.ConsoleHandler.level = INFO
     
    # Set the default logging level for new FileHandler instances
    weblogic.logging.ServerLoggingHandler.level = ALL

    We have to add the following argument for JVM to start using our properties file.

    java -Djava.util.logging.config.file=C:\mydomain\logging.properties weblogic.Server

    If we want to put our custom logging.properties into jar or war archive, we have to load it programmatically:

        private void initLogging() {
            InputStream inputStream = this.getClass().getResourceAsStream("/logging.properties");
            try
            {
                LogManager.getLogManager().readConfiguration(inputStream);
                System.out.println("Logging initialized");
            }
            catch (final IOException e)
            {
                Logger.getAnonymousLogger().severe("Could not load default logging.properties file");
                Logger.getAnonymousLogger().severe(e.getMessage() );
            }       
        }
     

     

     

    Категория: WebLogic administration and programming | Добавил: basil (02.03.2016)
    Просмотров: 461 | Рейтинг: 0.0/0
    Всего комментариев: 0
    Имя *:
    Email *:
    Код *:
    Бесплатный конструктор сайтов - uCoz