人気の面接質問と回答・オンラインテスト
面接対策、オンラインテスト、チュートリアル、ライブ練習のための学習プラットフォーム

集中型学習パス、模擬テスト、面接向けコンテンツでスキルを伸ばしましょう。

WithoutBook は、分野別の面接質問、オンライン練習テスト、チュートリアル、比較ガイドをひとつのレスポンシブな学習空間にまとめています。

面接準備

模擬試験

ホームページに設定

このページをブックマーク

メールアドレスを登録
WithoutBook LIVE 模擬面接 Log4j 関連する面接科目: 39

Interview Questions and Answers

Log4j の人気面接質問と回答を確認し、新卒者や経験者が就職面接の準備を進められます。

合計 35 問 Interview Questions and Answers

面接前に確認しておきたい最高の LIVE 模擬面接

Log4j の人気面接質問と回答を確認し、新卒者や経験者が就職面接の準備を進められます。

Interview Questions and Answers

質問を検索して回答を確認できます。

初心者 / 新卒向けの質問と回答

質問 1

What is Log4j?

Log4j (Log for Java) is logging framework provided by apache foundation for java based applications.
In the applicaitons, if you want to log some information, like any event triggered, or any Database updated is happened, we have the need to log the specific information or error for the useful of the application.
To debug any issues in applications, we have to log the error/exceptions in the logs. For this we will use log4j mechanism.
Log4j logs the information and shows this information in different targets. The different targets are called appenders (console, file etc)
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 2

What are the different logging levels?

There are several logging levels that you can configure in you applicaiton.
Those are FATAL, ERROR, WARN, TRACE, DEBUG, INFO and ALL in apache logging. 
Default logging level is INFO.
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 3

What is the importance of logging applications?

Logging helps in debugging as well. Although debuggers are available but frankly it takes time to debug an application using a debugger. An application can be debugged more easily with few well-placed logging messages. So we can safely say that logging is a very good debugging tool. If logging is done sensibly and wisely, it can provide detailed context for application failures.
In distributed applications (e.g. web/remote applications), the logging is very important. The administrator can read logs to learn about the problems that occurred during some interval.
Java's built-in APIs provide logging options but they are not that flexible. Another option is to use Apache's open source logging framework called log4j. 

Drawbacks of logging applications:
There are some drawbacks of use logging in your application. For example: logging will
- pollute the code
- increase the size of the code
- reduce the speed

These are important points because, we ultimately want efficient applications. Log4J has the solution to this. You may turn on or turn off the logging at runtime by changing the configuration file. This means no change in the Java source code (binary).

To reduce the code now in Spring Framework you can use of AOP (Aspect Oriented Programming) where you can configure log mechanisms easily.
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 4

Describe about logger levels in log4j.

Before using log4j framework, one should be aware of different categories of log messages. Following are 5 categories:

DEBUG
The DEBUG Level is used to indicate events that are useful to debug an application. Handling method for DEBUG level is: debug().

INFO
INFO level is used to highlight the progress of the application. Handling method for INFO level is: info().

WARN
The WARN level is used to indicate potentially harmful situations. Handling method for WARN level is: warn().

ERROR
The ERROR level shows errors messages that might not be serious enough and allow the application to continue. Handling method for ERROR level is: error().

FATAL
The Fatal level is used to indicate severe events that will may cause abortion of the application. Handling method for FATAL level is: fatal().

If you declare log level as debug in the configuration file, then all the other log messages will also be recorded. 
If you declare log level as info in the configuration file, then info, warn, error and fatal log messages will be recorded.
If you declare log level as warn in the configuration file, then warn, error and fatal log messages will be recorded.
If you declare log level as error in the configuration file, then error and fatal log messages will be recorded.
If you declare log level as fatal in the configuration file, then only fatal log messages will be recorded.
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 5

What are the three main components in log4j?

There are 3 main components that are used to log messages based upon type and level. These components also control the formatting and report place at runtime. These components are:
  • loggers
  • appenders
  • layouts
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 6

Explain why to use Apache Log4j.

  • Apache log4j is an open-source and due to this, it's completely free to use.
  • You can easily save log information into either files or even databases.
  • Can be used for projects of any size small, medium, or large.
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 7

What are the features of log4j?

The following are features of log4j:

  • Log4j is thread-safe.
  • It is optimized for speed.
  • It is based on a named logger hierarchy.
  • It supports multiple output appenders per logger.
  • It supports internationalization.
  • It is not restricted to a predefined set of facilities.
  • Logging behavior can be set at runtime using a configuration file.
  • It is designed to handle Java Exceptions from the start.
  • It uses multiple levels, namely ALL, TRACE, DEBUG, INFO, WARN, ERROR, and FATAL.
  • The format of the log output can be easily changed by extending the Layout class.
  • The target of the log output as well as the writing strategy can be altered by implementations of the Appender interface.
  • It is a fail-stop. However, although it certainly strives to ensure delivery, log4j does not guarantee that each log statement will be delivered to its destination.
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 8

What are the two static methods for obtaining a logger object?

The two static methods in log4j for obtaining a logger object are:

  • public static Logger getRootLogger()
  • public static Logger getLogger(String name)
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 9

How log4j file is defined?

Log4j file is defined by the name log4j.properties, it keeps properties in key-value pairs. By default, the log manager looks for a file name log4j.properties in the CLASSPATH.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 10

What is package-level logging in log4j?

Package level logging is the standard logging of log4j, with this we would determine the package and the associated level.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 11

What are the Pros and Cons (advantages and disadvantages) of Logging?

Following are the Pros and Cons of Logging:

  • Logging is an important component of software development. A well-written logging code offers quick debugging, easy maintenance, and structured storage of an application's runtime information.
  • Logging does have its drawbacks also. It can slow down an application. If too verbose, it can cause scrolling blindness. To alleviate these concerns, log4j is designed to be reliable, fast, and extensible.
  • Since logging is rarely the main focus of an application, the log4j API strives to be simple to understand and use.
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 12

What is the purpose of DEBUG log level?

The DEBUG log level designates fine-grained informational events that are most useful to debug an application.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 13

What is the purpose of the ERROR log level?

The ERROR log level designates error events that might still allow the application to continue running.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 14

What is the purpose of the FATAL log level?

The FATAL log level designates very severe error events that will presumably lead the application to abort.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 15

What is the purpose of the INFO log level?

The INFO log level designates informational messages that highlight the progress of the application at a coarse-grained level.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 16

What is the purpose of the OFF log level?

The OFF log level is the highest possible rank and is intended to turn off logging.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 17

What is the purpose of the TRACE log level?

The TRACE log level designates finer-grained informational events than the DEBUG.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 18

What is the purpose of the WARN log level?

The WARN log level designates potentially harmful situations.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 19

How do Log Levels work or tell the log level hierarchy?

A log request of level p in a logger with level q is enabled if p >= q. This rule is at the heart of log4j. It assumes that levels are ordered. For the standard levels, we have ALL < DEBUG < INFO < WARN < ERROR < FATAL < OFF.

For example: if the log level is mentioned as 'WARN' in the log4j properties. Then the logs will be coming in the log file are: WARN, ERROR, FATAL

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 20

What are different appenders that can configure in log4j?

There are different appenders that we can configure in log4j are: CONSOLE, FILES, DATABASE, JMS, EVENT LOGGING.

Mainly used appenders:
CONSOLE in log4j:- If we use this as appenders in your application, log4j logs the information in the console or command prompt window that is started with startup script.
Files in log4j:- Files Appender is used to log the information into our custom name files. when we are configuring this appender, we can specify the file name.
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 21

How will you define a root logger turning DEBUG mode off?

The following syntax defines the root logger with WARN mode turning DEBUG mode off.

# Define the root logger with appender file

log = /usr/home/log4j log4j.rootLogger = WARN, FILE

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る

中級 / 1年から5年経験向けの質問と回答

質問 22

What are different types of logs?

Usually in any application there two types of logs.
1. Application server logs:- These are the logs configured at the application server level. for example in tomcat, we have log files called localhost.log, tomcat.log, catalina.log, stdout.log, sterr.log. all these logs are showing with default settings defined in logging.properites located in your tomcat installation folder/conf folder.
If you want custom settings, we have to change the different parameters in logging.properties in conf folder of tomcat directory.
2. Application logs:- We can define logging at each applicaiton level, For this we have to create log4j.xml or logging.properties in WEB-INF/classes folder.
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 23

In log4j how can you log into the database?

The log4j API provides the object org.apache.log4j.jdbc. JDBCAppender object can put logging information in a particular database.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 24

Explain what does WARN and TRACE level indicates in log4j?

Log4j level WARN gives a warning about an unpredicted event to the user. The messages coming out of this level may not stop the progress of the system.

The TRACE level provides more detailed information than the DEBUG level, and it will stay at the top of the hierarchy.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る

経験者 / エキスパート向けの質問と回答

質問 25

How do you define logging for your application?

To define logging for your application, you have to download the log4j framework (log4j.jar) from the apache site.
Once log4j jars are downloaded, make sure that these jars are in classpath of your application. lets say you have web-application need to be added log4j. In this case, log4j jars are copied to WEB-INF/lib folder of your web application.
create new file either logging.properties or log4j.xml which will be copied to WEB-INF/classes folder.
logging.properties/log4j.xml contains the all the configuration related to logging mechanism and logger level and package that you want to define logger level.

Example:
logging.properties:
logger.level=INFO
logger.handlers=CONSOLE,FILE,RejRec
handler.RejRec=org.jboss.logmanager.handlers.PeriodicRotatingFileHandler
handler.RejRec.level=WARN
handler.RejRec.formatter=RejRec
handler.RejRec.properties=append,autoFlush,enabled,suffix,fileName
handler.RejRec.append=true
handler.RejRec.autoFlush=true
handler.RejRec.enabled=true
handler.RejRec.suffix=.yyyy-MM-dd
handler.RejRec.fileName=E:\Docs\WithoutBook\DID\jboss-eap-6.2\standalone\log\RejectedRecords.log

log4j.xml:
<log4j:configuration>
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
        <appender-ref ref="LOG"/>
</appender>

<appender name="MEETING-APP-LOG" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="E:/Softwares/glassfish_dump/glassfish/domains/domain1/logs/meeting_app.log" />
<param name="Append" value="true"/> 
<param name="DatePattern" value="'.'yyyy-MM-dd-a"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd} %d{HH:mm:ss,SSS} %-5p [%t] %c - %m%n" />
</layout>
</appender>

  <logger name="com.withoutbook" additivity="false">
         <level value="warn"/>
         <appender-ref ref="MEETING-APP-LOG"/>
</logger>

     <root>
         <priority value="debug"/>
         <appender-ref ref="ASYNC"/>
         <appender-ref ref="ERROR-LOG"/>
</root>
</log4j:configuration>
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 26

What are the other support objects in Log4j?

There are other support objects in the Log4j framework are:

  • Level Object
  • Filter Object
  • Object Renderer
  • Log Manager
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 27

Explain whether log4j is a thread safe.

Log4j is a thread-safe, log4j components are built to be used in multithread systems.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 28

Explain whether a log output format can be customized.

Yes, you can extend the layout class to create your own customized log format. Appenders can be parameterized to use the layout of your choice.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 29

What are the system properties checked by log4j?

The system properties checked by log4j are

  • Log4j debug, if true, log4j will show internal debugging messages to the console
  • defaultInitOverride, if true, log4j will not execute default initialization
  • configuration, URL for default initialization configuration file
  • configurationClass, Class name for configurator to execute default initialization configuration file
  • ignoreTCL, if true, the thread class loader will be overlooked when loading classes
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 30

What is the role of the filter in log4j?

Filter objects in log4j decide whether logging requests should be handled by a particular Appender or ignored.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 31

How can you get multiple processes to log into the same file?

You may have each process log to a socket Appender. The receiving socket server can receive all the events and send them to a single log file.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 32

What is the difference between Threshold and LevelRangeFilter in log4j?

Both Threshold and LevelRangeFilter do the same thing.

However, the threshold should be faster. Filters enable you to implement your own logic, and you can also link them together if required. If you need a basic threshold functionality, then the “threshold” function will be enough.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 33

What are the format characters used in log4j?

The format characters used in log4j are

  • L – it is used to output the line number from where the logging request was processed or issued
  • m – It is used to output the application-supplied message related to the logging event
  • p – It is used to output the priority of the logging event
  • C – It is used to output the class name of the caller issuing the logging request

When any number is used along with the character it means the priority of the logging event should be justified to a width of 4 characters.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 34

Mention what is the best way to migrate from java.util logging to apache log4j?

The best way to migrate from java.util logged to log4j is to use the global file search/replace method.  It will replace with “org.apache.log4j.Logger”.

Then verify the project with the build.

復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る
質問 35

Why do you get multiple copies of the message in log file sometime?

There could be two reasons why this might happen:

  • Repeated configuration of log4j
  • Attaching the same appenders to multiple loggers
復習用に保存

復習用に保存

この項目をブックマークに追加したり、難しい内容としてマークしたり、復習セットに入れたりできます。

マイ学習ライブラリを開く
役に立ちましたか?
コメントを追加 コメントを見る

ユーザー評価で最も役立つ内容:

著作権 © 2026、WithoutBook。