Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.2

# ErrorLog::SetLog( const char * )

Redirects this `Error’s` `Report()` output to a file.

Virtual? | No |
Class | `ErrorLog` |
Arguments | `const char *file` | the file to serve as an error log
Returns | `void` |

## Notes

After `SetLog()` is called on a given `Error` object, `Report()` directs its output to the specified file rather than `stderr`. This setting applies only to the specified `Error` object.

## Example

The following example redirects an `Error’s` output to a log file, and then writes the `Error’s` text to that log file.

    ClientApi client;
    Error e;

    ErrorLog::SetLog( "C:\Perforce\errlog" );
    client.Init( &e );
    ErrorLog::Report();

Your search for returned results