Как настроить вход Java с помощью файла свойств? (java.util.logging)

Вы никогда не знаете, достаточно ли задержка; так что более чистое решение - просто сделать презентацию в следующем цикле выполнения.

 dispatch_async(dispatch_get_main_queue(), ^(void){
    [self presentViewController:yourPopoverr animated: YES completion: nil];
  });
78
задан VolkA 5 January 2016 в 10:23
поделиться

3 ответа

Okay, first intuition is here:

handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
.level = ALL

The Java prop file parser isn't all that smart, I'm not sure it'll handle this. But I'll go look at the docs again....

In the mean time, try:

handlers = java.util.logging.FileHandler
java.util.logging.ConsoleHandler.level = ALL

Update

No, duh, needed more coffee. Nevermind.

While I think more, note that you can use the methods in Properties to load and print a prop-file: it might be worth writing a minimal program to see what java thinks it reads in that file.


Another update

This line:

    FileInputStream configFile = new FileInputStream("/path/to/app.properties"));

has an extra end-paren. It won't compile. Make sure you're working with the class file you think you are.

26
ответ дан 24 November 2019 в 10:35
поделиться

вы можете настроить файл конфигурации ведения журнала через командную строку:

$ java -Djava.util.logging.config.file = / path / to / app.properties MainClass

this путь кажется чище и проще в обслуживании.

90
ответ дан 24 November 2019 в 10:35
поделиться

Вы ищете файл журнала по правильному пути: % h / one% u.log

Здесь% h переходит в ваш дом: В Windows это значение по умолчанию: C: \ Documents and Settings (имя_пользователя).

Я попробовал опубликованный вами образец кода, и он отлично работает после того, как вы укажете путь к файлу конфигурации (logging.properties с помощью кода или аргументов java).

3
ответ дан 24 November 2019 в 10:35
поделиться
Другие вопросы по тегам:

Похожие вопросы: