java - Windows Event log file -


i have program reads file every time , want read event log file of windows ,how can location , read contents.

the logs stored in %systemroot%\system32\config directory .evt extension. within computer manager can export them .txt or .csv file.

windows vista/7/server2008 location, here is: %systemroot%\system32\winevt\logs

my code is:

string fileseperator = file.separator; string filepath = "c:" + fileseperator + "windows" + fileseperator + "system32" + fileseperator + "winevent" + fileseperator + "logs"; system.out.println("filepath :" + filepath); file f = new file(filepath); system.out.println("is directory :" + f.isdirectory()); 

the output:

filepath : c:\windows\system32\winevent\logs

is directory :false

why return not directory?

because file doesn't exist. said location %systemroot%\system32\winevt\logs. yet use c:\windows\system32\winevent\logs.

winevt != winevent.


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -