简体   繁体   中英

Erlang - Is it possible to make the messages that appear on erlang shell appear on linux shell too?

I have created a small test application and when on a linux machine I would like to see the messages that appear on the erlang shell to appear on the linux as well. I am not sure how it could be done, but is it possible?

I am running the application in detached mode(erlang shell).

EDIT:

I meant the message passing to the linux shell.

Example: When I start my application using,

test application <start/stop>

I would get a message on the Linux shell Test Application has successfully started

But if I was like copying files, I would like the progress of the file copy to be displayed on the Linux shell like,

Copy successful. Number of files copied : 1
Copy successful. Number of files copied : 2
....

So is it possible to do the above using the message passing from Erlang to Linux?

I believe you can use some logger for this purposes. For example lager can redirect logs to several facilities at the same time, eg file and erlang console.

Other option is to use "run_erl", utility which comes with erlang distribution and allows "redirect the standard input and standard output streams so that all output can be logged".

Try erl -man run_erl or you can see can generate "release" with rebar, it will generate startup scripts which use "run_erl".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM