# Logging best practice

**URL:** <https://forum.dfinity.org/t/logging-best-practice/13289>\
**Category:** JavaScript\
**Created:** [May 25, 2022, 8:17pm UTC](https://forum.dfinity.org/t/logging-best-practice/13289 "2022-05-25T20:17:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyan](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/kyan/32/6488_2.png) [@Kyan](https://forum.dfinity.org/u/Kyan)\
**Post date:** [May 25, 2022, 8:17pm UTC](https://forum.dfinity.org/t/logging-best-practice/13289/1 "2022-05-25T20:17:28Z")

</div>

Hi, I’m new on Motoko development, coming from the world of Java.  
I wonder what is the best way to write a debug log and how to consult all messages if necessary ?

```auto
Debug.print("Is it possible, from the on-chain canister, to view this line later ?");

```

Thanks 😉

---

<div class="post-metadata">

**Author:** ![paulyoung](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulyoung/32/5251_2.png) [@paulyoung](https://forum.dfinity.org/u/paulyoung)\
**Post date:** [May 25, 2022, 8:50pm UTC](https://forum.dfinity.org/t/logging-best-practice/13289/2 "2022-05-25T20:50:19Z")

</div>

You might consider using something like canistergeek for that:

> **[GitHub - usergeek/canistergeek-ic-motoko: Canistergeek Motoko Library](https://github.com/usergeek/canistergeek-ic-motoko)**
>
> Canistergeek Motoko Library. Contribute to usergeek/canistergeek-ic-motoko development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [May 27, 2022, 6:36am UTC](https://forum.dfinity.org/t/logging-best-practice/13289/3 "2022-05-27T06:36:46Z")

</div>

> [@Kyan](#):
>
> `Debug.print("Is it possible, from the on-chain canister, to view this line later ?");`

When developing locally, this will be printed to the replica console (the stuff you see if you run `dfx start` without a `--background` flag). On the live deployment, there’s currently no way to see your canister’s logs. For that, other tools (like the one mentioned by Paul) are necessary.

---

<div class="post-metadata">

**Author:** ![Kyan](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/kyan/32/6488_2.png) [@Kyan](https://forum.dfinity.org/u/Kyan)\
**Post date:** [June 2, 2022, 4:32pm UTC](https://forum.dfinity.org/t/logging-best-practice/13289/4 "2022-06-02T16:32:35Z")

</div>

Ok ! Thanks for your answers 😉
