# How to log all output in console to file?

**URL:** <https://discourse.julialang.org/t/how-to-log-all-output-in-console-to-file/27557>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 14, 2019, 8:42pm UTC](https://discourse.julialang.org/t/how-to-log-all-output-in-console-to-file/27557 "2019-08-14T20:42:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wenqi\_kou](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wenqi_kou/32/9348_2.png) [@wenqi\_kou](https://discourse.julialang.org/u/wenqi_kou)\
**Post date:** [August 14, 2019, 8:42pm UTC](https://discourse.julialang.org/t/how-to-log-all-output-in-console-to-file/27557/1 "2019-08-14T20:42:10Z")

</div>

I want to log all outputs in console into a file, including all records automatically generates at run time.

For example, when I use Mosek to solve some problems, I need these data logged in the output file. These data are automatically generated in console.

![image](https://global.discourse-cdn.com/julialang/original/3X/d/8/d84d295883de5e99369a1c7e3cb5b37142fe9ab7.png)

Can Julia do this? Thanks!

---

<div class="post-metadata">

**Author:** ![wenqi\_kou](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wenqi_kou/32/9348_2.png) [@wenqi\_kou](https://discourse.julialang.org/u/wenqi_kou)\
**Post date:** [August 14, 2019, 8:59pm UTC](https://discourse.julialang.org/t/how-to-log-all-output-in-console-to-file/27557/2 "2019-08-14T20:59:07Z")

</div>

In this example, I wrote this Mosek slover in a function like,

```julia
function sol! (...)
    model = Model(with_optimizer(Mosek.Optimizer))
    ...
    optimize!(model)
    return
end

```

So, how can I log function “sol!(…)” in a file?
