- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
I have accidentally deleted my current hdfs-audit.log file and namenode.log file. How to create a new log files without restarting name node?
- Labels:
-
Apache Hadoop
Created ‎07-21-2017 05:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created ‎07-21-2017 05:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hdfs-audit and namenode log files are generated via log4j framework. Which is initialized at the time of component startup and creates the log file for writing or use the existing log file for writing in append mode. However if you delete these log files in the running mode of the components then the logging will not be reinitialized hence you will not see the new log file generated. This happens because the log4j appender will has a handle for the deleted file hence it will continue to write to it (which does not exist now because it is deleted), log4j will not detect that it has been deleted.
In custom applications we can make it happen by reinitializing the logging configuration via code, But existing components like NameNode does not control logging initialization/resetConfiguration at the code level.
org.apache.log4j.LogManager.resetConfiguration();
So you will need to restart the affected components (like NameNode in this case) to see the new files getting created.
Created ‎07-21-2017 05:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hdfs-audit and namenode log files are generated via log4j framework. Which is initialized at the time of component startup and creates the log file for writing or use the existing log file for writing in append mode. However if you delete these log files in the running mode of the components then the logging will not be reinitialized hence you will not see the new log file generated. This happens because the log4j appender will has a handle for the deleted file hence it will continue to write to it (which does not exist now because it is deleted), log4j will not detect that it has been deleted.
In custom applications we can make it happen by reinitializing the logging configuration via code, But existing components like NameNode does not control logging initialization/resetConfiguration at the code level.
org.apache.log4j.LogManager.resetConfiguration();
So you will need to restart the affected components (like NameNode in this case) to see the new files getting created.
Created ‎07-23-2017 08:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If this helped answering your query then it will be great if you mark this thread as "Answered" by clicking on the "Accepted" link, that way it will be helpful for HCC users to quickly find the answered threads.
Created ‎07-21-2017 11:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks @Jay SenSharma for your suggestion. It worked fined after the reboot.
Created ‎07-23-2017 07:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#thank_you @Jay SenSharma sir
