0

There is the following line command:

statdump -zdl %db% > "%ckpdb_dir%"\statdump_%db%.log

the result of the Statdump is sent to the log file, but I would like that if there is some error, for example that the statdump is being used already by another process, and then I get the message "The process cannot access the file because it is being used by anoter process on the screen, but I would like to capture these message in a file.

I tried with:

statdump -zdl %db% > "%ckpdb_dir%"\statdump_%db%.log > ckpdb.log

but is not the solution...

btw there is no error generated when happen this

2 Answers2

0

You want to redirect stderr somewhere else than stdout like this:

statdump -zdl %db% >"%ckpdb_dir%\statdump_%db%.log" 2>err.log

The last part redirects stderr to the file err.log.

Helge Klein
  • 8,829
  • 8
  • 51
  • 71
  • I have runned the line into a batch file, together with the same file in another terminal command of windows, but the message is shown instead that written into the err.log :( –  Nov 19 '10 at 12:37
  • @aemme Could you explain better what you got in the err.log using this? – Dr. belisarius Nov 19 '10 at 12:44
  • This command illustrates the principle: "xcopy sdfjls >log.txt 2>err.txt". It creates both files, log.txt and err.txt, one with output from stdout and the other with output from stderr. – Helge Klein Nov 19 '10 at 12:46
  • also because the %errorlevel% is managed after tah line, but this emssage is given with %errorlevel% = 0.... –  Nov 19 '10 at 12:56
  • yes the sterr works perfectly but the message I told you is always shown in the monitor... –  Nov 19 '10 at 13:06
0

Try this:

statdump -zdl %db% -o "%ckpdb_dir%\statdump_%db%.log" 2> error.log
Dr. belisarius
  • 60,527
  • 15
  • 115
  • 190
  • the "-o" flag doesn't work like you thought, it writes in the db.log file the correct sintax to use with the statdump (so error) –  Nov 23 '10 at 10:47
  • maybe I think this happen only when a direct the output into a file, because in this case only one process can write into it –  Nov 23 '10 at 10:57