FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java-labs/java-web-ru/logging/examples/Example.java at main · vmorkhat/java-labs · GitHub
vmorkhat
/
java-labs
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Issues
1
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java-labs
/
java-web-ru
/
logging
/
examples
/
Example.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (27 loc) · 1.5 KB
Breadcrumbs
java-labs
/
java-web-ru
/
logging
/
examples
/
Example.java
Copy path
File metadata and controls
34 lines (27 loc) · 1.5 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// // Файл конфигурации логгера
// // Обработчики
// // Вывод логов в файл и в консоль
// handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
// // Настраиваем обработчик FileHandler, который пишет логи в файл
// // Уровень логгирования
// java.util.logging.FileHandler.level = INFO
// // Формат вывода
// java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
// java.util.logging.FileHandler.append = true
// // Файл, в который будет происходить запись лога
// java.util.logging.FileHandler.pattern = log.txt
// // Сервлет
// public class WelcomeServlet extends HttpServlet {
// // Получаем логгер
// private static final Logger LOGGER = LoggerFactory.getLogger(WelcomeServlet.class);
// @Override
// public void doGet(HttpServletRequest request,
// HttpServletResponse response)
// throws IOException, ServletException {
// // Производим запись лога с уровнем INFO
// // При каждом GET запросе на стартовую страницу, в файл будет записываться лог
// LOGGER.log(Level.INFO, "Страница загружена");
// PrintWriter out = response.getWriter();
// out.println("Hello, Hexlet!");
// }
// }
Back
|
FazBrowse Home
|
New Git URL