# PetscLogTraceBegin
Activates trace logging.  Every time a PETSc event begins or ends, the event name is printed. 
## Synopsis
```
#include "petscsys.h"   
PetscErrorCode PetscLogTraceBegin(FILE *file)
```
Logically Collective on `PETSC_COMM_WORLD`


## Input Parameter

- ***file -*** The file to print trace in (e.g. stdout)



## Options Database Key

- ***-log_trace [filename] -*** Activates `PetscLogTraceBegin()`





## Notes
`PetscLogTraceBegin()` prints the processor number, the execution time (sec),
then "Event begin:" or "Event end:" followed by the event name.

`PetscLogTraceBegin()` allows tracing of all PETSc calls, which is useful
to determine where a program is hanging without running in the
debugger.  Can be used in conjunction with the -info option.


## See Also
 [](ch_profiling), `PetscLogDump()`, `PetscLogAllBegin()`, `PetscLogView()`, `PetscLogDefaultBegin()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/logging/plog.c.html#PetscLogTraceBegin">src/sys/logging/plog.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/logging/plog.c)


[Index of all Profiling routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
