# Logging in temporal workflow & Activities

**URL:** <https://community.temporal.io/t/logging-in-temporal-workflow-activities/9836>\
**Category:** Community Support\
**Tags:** logging, typescript-sdk\
**Created:** [October 16, 2023, 6:39am UTC](https://community.temporal.io/t/logging-in-temporal-workflow-activities/9836 "2023-10-16T06:39:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kishore\_kumar](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/kishore_kumar/32/4015_2.png) [@kishore\_kumar](https://community.temporal.io/u/kishore_kumar)\
**Post date:** [October 16, 2023, 6:39am UTC](https://community.temporal.io/t/logging-in-temporal-workflow-activities/9836/1 "2023-10-16T06:39:20Z")

</div>

What’s the best logging mechanism for temporal workflows & activities and other places, which can be initialized at one place & can be propagated to all places. In TypeScript.  
Thank you

---

<div class="post-metadata">

**Author:** ![jwatkins](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/jwatkins/32/2581_2.png) [@jwatkins](https://community.temporal.io/u/jwatkins)\
**Post date:** [October 19, 2023, 9:26pm UTC](https://community.temporal.io/t/logging-in-temporal-workflow-activities/9836/2 "2023-10-19T21:26:18Z")

</div>

You can register a custom logger using `Runtime.install({ logger })`, as demonstrated here:

```auto
  Runtime.install({
    logger: myCustomLogger,
  });

```

You can then use that logger from your workflow code by using the `log` object provided by the `@temporalio/workflow` package, such as:

```auto
import { log, proxyActivities } from '@temporalio/workflow';

export async function logSampleWorkflow(): Promise<void> {
  log.info('Greeted', { ... can add extra details here ... });
}

```

Similarly, you can use that logger from your activities by using the `Context.log` object, such as:

```auto
import { Context } from '@temporalio/activity';

export async function greet(name: string): Promise<void> {
  const { log } = Context.current();
  log.info('Log from activity', { name });
}

```

See the complete example [here](https://github.com/temporalio/samples-typescript/tree/main/custom-logger).
