Git Product home page Git Product logo

ale-1's Introduction

ale

ale, a lager extension, makes it possible for several processes to trace the same modules.

Dependencies

To build ale you will need a working installation of Erlang R15B (or later).
Information on building and installing Erlang/OTP can be found here (more info).

ale is built using rebar that can be found here, with building instructions here.

ale also requires lager to be installed.

Downloading

Clone the repository in a suitable location:

$ git clone git://github.com/tonyrog/ale.git

Functionality

Concepts

ale extends lager by using a server that keeps track of all trace request thus making it possible for several processes to add the same traces while only adding one to lager and likewise not removing it from lager until all processes have removed it.. Available api is:

  • trace(on | off, ModuleOrPidOrFilter::atom() | pid() | tuple() | list(tuple)), Loglevel::atom()) - prints trace output on console as long as calling process hasn't terminated.
  • trace(on | off, ModuleOrPidOrFilter::atom() | pid() | tuple() | list(tuple)), Loglevel::atom(), File::string()) - prints trace output to File as long as calling process hasn't terminated. File must exist.
  • trace_gl(on | off, ModuleOrPidOrFilter::atom() | pid() | tuple() | list(tuple)), Loglevel::atom()) - prints trace output on console as long as calling process' group leader hasn't terminated. Suitable for calls from a shell.
  • trace_gl(on | off, ModuleOrPidOrFilter::atom() | pid() | tuple() | list(tuple)), Loglevel::atom(), File::string()) - prints trace output to File as long as calling process' group leader hasn't terminated. Suitable for calls from a shell. File must exist.
Filter is a tuple {tag, Tag} that lager uses to determine what to output.
LogLevel is debug | info | notice | warning | error | critical | alert | emergency.
See lager documentations for more details.
Examples:
ale:trace(on, sz_master, debug).
ale:trace(on, self(), debug).
ale:trace_gl(on, sz_node, info, "/tmp/ale.log").
ale:trace(off, sz_master, debug)
ale:trace(on, [{module, ale}, {function, start}], debug).

Config Files

Arguments to all applicable erlang applications are specified in an erlang configuration file.
Traces can be added to the ale part of the configuration file. These traces will be active as long as ale i running.
Example:
{init_traces, [
{[{module, sz_master}], debug},
{[{module, sz_node}], info, "/tmp/ale.log"}
]}

An example can be found in "sys.config".

Tips

If you start traceing using the non-groupleader function calls from the shell you can stop it by 'crashing' the shell, for ex with A=B. Might be handy if you get more output than expected ;-)

Building

Rebar will compile all needed dependencies.
Compile:

$ cd ale
$ rebar compile
...
==> ale (compile)

Running

There is a quick way to run the application for testing:

$ erl -sname ale -config sys -pa <path>/ale/ebin
>ale:start().

(Instead of specifing the path to the ebin directory you can set the environment ERL_LIBS.)

Stop:

>halt().

Release

To generate a proper release follow the instructions in Release Handling or look in the Rebar tutorial.

Before the last step you have to update the file "ale/rel/files/sys.config" with your own settings. You probably also have to update "ale/rel/reltool.config" with the correct path to your application (normally "{lib_dirs, ["../.."]}") and all apps you need.

       {app, sasl,   [{incl_cond, include}]},
       {app, stdlib, [{incl_cond, include}]},
       {app, kernel, [{incl_cond, include}]},
       {app, lager, [{incl_cond, include}]}
       {app, ale, [{incl_cond, include}]}

And then you run:

$ rebar generate

.

When generating a new release the old has to be (re)moved.

Start node:

$ cd rel
$ ale/bin/ale start

(If you want to have access to the erlang node use

console 

instead of

start

.)

Documentation

ale is documented using edoc. To generate the documentation do:

$ cd ale
$ rebar doc

ale-1's People

Contributors

malotte avatar tonyrog avatar uwiger avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.