Interview Questions and Answers - Order By Newest Q1621. in the following log4j config file, How should we change the file name and format
<Configuration status="DEBUG">
<Appenders>
<RollingFile name="File" fileName="logs/xyz.log" filePattern="logs/xyz-%d{MM-dd-yyyy}.log.gz">
<TimeBasedTriggeringPolicy />
</RollingFile>
</Appenders>
<Loggers>
<Root level="DEBUG">
<AppenderRef ref="File" />
</Root>
</Loggers>
</Configuration> Log4j
Ans. We can specify the file name with fileName property within RollingFile. File name pattern for the rolled logs can be specified using filePattern property. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1622. In the following log4j config, What if we don't need rolling logs
<Configuration status="DEBUG">
<Appenders>
<RollingFile name="File" fileName="logs/xyz.log" filePattern="logs/xyz-%d{MM-dd-yyyy}.log.gz">
<TimeBasedTriggeringPolicy />
</RollingFile>
</Appenders>
<Loggers>
<Root level="DEBUG">
<AppenderRef ref="File" />
</Root>
</Loggers>
</Configuration> Log4j
Ans. We can change the appender from RollingFile to File or we can specify a new File appender and set that within AppenderRef Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1623. What are some of the Log4j appenders ? Log4j
Ans. https://logging.apache.org/log4j/2.x/manual/appenders.html Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1624. Can you organize following Log4j levels in hierarchy ?
WARN, DEBUG,INFO, ERROR Log4j
Ans. DEBUG
INFO
WARN
ERROR
Root Log level of DEBUG will print all
Root Log Level of INFO will print INFO, WARN and ERROR
Root Log level of WARN will print WARN and ERROR
Root Log level of ERROR will print ERROR alone Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Log4j levels hierarchy  Log4j Q1625. What are the application Logging levels specified in your applications ? Log4j
Ans. In our Organization, the policy is to keep it WARN in production so as to reduce logging Noise. We use Info in Test environments. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1626. What should be the logging level while logging exceptions ? Log4j
Ans. It depends on how severe the exception is. If the exception is completely unexpected and breaks the request, It should be logged as ERROR or FATAL. If it's not expected but we can live with it and the application request continue in-spite of it, It should be WARN. If it's expected , it can be just INFO. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1627. What is the difference between INFO and DEBUG logging levels ? Log4j
Ans. Info Messages are something which we would like to see even if the application is in best of state. DEBUG messages are usually something that we would like to see while debugging some problem. DEBUG is lower level than Info. Any message logged with info gets printed if the Root level set is DEBUG. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Log4j  Log4j levels Q1628. What is the difference between DEBUG and TRACE logging levels ? Log4j
Ans. TRACE designates finer grained informational events than the DEBUG.TRACE is level lower than DEBUG. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Log4j  DEBUG vs TRACE Q1629. how many reducer task runs on a hadoop cluster ? BigData
Ans. Generally one reducer runs for all mappers, but it can be increased as per requirements. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Hadoop  BigData Asked in 1 Companies Q1630. How to change the backup log directory using log4j ? Log4j
Ans. There is a property called "filePattern" within appender that regulates where the backed up files will be created for rolling logs. It actually contains the absolute path which can be modified to have backed up logs within some other directory. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Log4j Q1631. What does the property maxBackupIndex in Log4j means ? Log4j
Ans. It means that the app will only maintain these many backed up log files. Older backed up logs will be deleted. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Log4j Q1632. What is the use of Property files ?
Ans. Property files are used to maintain configurable values as key value pairs. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  config  property files This question was recently asked at 'Veritas'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Mutex vs Semaphore Asked in 1 Companies This question was recently asked at 'Veritas'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies This question was recently asked at 'Veritas'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies This question was recently asked at 'Veritas'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1637. Given array of integers, find first two numbers that adds up to 10. Core Java
This question was recently asked at 'Amazon'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Code  Coding Asked in 1 Companies Ans. array is traversed from first element to last element. Here current element is compared with next element. If current element is greater than next element it is swapped. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sorting  bubble sort Asked in 1 Companies Q1639. Write code to check if a Binary tree is symmetrical Algorithm
This question was recently asked at 'Amazon'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  binary tree Asked in 1 Companies Q1640. Write a program to reverse words of a sentence. Core Java
This question was recently asked at 'Amazon'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  code  Coding Asked in 1 Companies Q1641. how to get most significant bit from a byte? Core Java
This question was recently asked at 'Amazon'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1642. What data structure will you use if we have to search an element in million of elements ? Data Structure
This question was recently asked at 'Microsoft'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Search Asked in 1 Companies Q1643. Write a function that returns the depth of a tree. Algorithm
This question was recently asked at 'Amazon'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1644. Write code to find the node where two linked lists intersect. Algorithm
This question was recently asked at 'Amazon'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1645. Check if tic tac toe has a winner Algorithm
This question was recently asked at 'Microsoft'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1646. Write program to balance a binary tree Algorithm
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1647. Given a graph, find if it represents a tree Algorithm
Ans. We can simply find it by checking the criteria of a tree. A tree will not contain a cycle, so if there is any cycle in the graph, it is not a tree. We can check it using another approach, if the graph is connected and it has V-1 edges, it could be a tree. Here V is the number of vertices in the graph Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1648. Explain different sorting algorithms and Big O of each Algorithm
This question was recently asked at 'Microsoft,ServiceNow'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 2 Companies Q1649. Write a program to find loop in a linked list Algorithm
This question was recently asked at 'Microsoft'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q1650. How to convert a bst to doubly linked list Algorithm
This question was recently asked at 'Amazon'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies