Skip to content
Elixir Logger Backend that writes to the Linux Ramoops driver
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Test more versions on CircleCI Jun 19, 2019
lib Rename OopsLogger to RamoopsLogger Jul 8, 2019
test Rename OopsLogger to RamoopsLogger Jul 8, 2019
.formatter.exs Initial development Feb 1, 2019
.gitignore Initial development Feb 1, 2019 v0.3.0 Jul 8, 2019
LICENSE Apache-2.0 Jun 19, 2019 Update README text and add demo Jul 15, 2019
mix.exs v0.3.0 Jul 8, 2019
mix.lock Bump deps Jun 19, 2019


CircleCI Hex version

This is an Elixir Logger backend for forwarding log messages to the ramoops logger on Linux and Nerves systems. Messages sent to this log are written to a special area of DRAM that can be recovered after reboots or very short power outages.

Here's a demo video:

RamoopsLogger Demo


RamoopsLogger uses the Linux pstore device driver, so it only works on Linux-based platforms. Most official Nerves Projects systems start the pstore driver automatically and you can skip the Linux configuration.

Linux configuration

The most important part of using the RamoopsLogger is ensuring that the pstore device driver is enabled and configured in your Linux kernel. The device driver writes logs to a fixed location in DRAM that is platform-specific. If you are lucky, someone will have determined a good place to store the logs. The official Nerves Project systems all have a small amount of memory allocated for use by the pstore driver. If you are not using Nerves, it's possible that one of the device tree files (for ARM platforms) may be helpful.

If you're not using an official Nerves system, here's an example device tree fragment that would need to be updated for your device, but may be helpful as a start.

reserved-memory {
        #address-cells = <1>;
        #size-cells = <1>;

                compatible = "ramoops";
                reg = <0x88d00000 0x100000>;
                ecc-size = <16>;
                record-size     = <0x00020000>;
                console-size    = <0x00020000>;
                ftrace-size     = <0>;
                pmsg-size       = <0x00020000>;

One way of testing whether the pstore driver is available is to check whether the /dev/pmsg0 file exists.

Update your Elixir project

Once you're satisfied with the Linux, add ramoops_logger to your project's mix.exs dependencies list.

def deps do
    {:ramoops_logger, "~> 0.3.0"}

Next, update your config.exs to tell the Elixir Logger to send log messages to the RamoopsLogger:

use Mix.Config

# Add the RamoopsLogger backend. If you already have a logger configuration, to add
# RamoopsLogger the only change needed is to add RamoopsLogger to the :backends list.
config :logger, backends: [RamoopsLogger, :console]

IEx Session Usage

To read the last ramoops log to the console run:

iex> RamoopsLogger.dump()

To read the last ramoops log and it to a variable run:

iex> {:ok, contents} =

Nerves Automatic Log Check

If you want to have your system check if there is an oops log available, and you are using Nerves, you can add this to your rootfs_overlay/etc/iex.exs file in your firmware project:

if RamoopsLogger.available_log?() do
  IO.puts("Oops! There's something in the oops log. Check with RamoopsLogger.dump()")
You can’t perform that action at this time.