pfitz

pfitz

What are your debugging techniques?

Coming from Objective-C/Swift/PHP/Java I am used to a full IDE for my projects. The one thing I miss the most is a good debugger. So far I just did „poor mans debugging“ with IO.inspect but I am guessing there are better ways to debug ones elixir apps. So how do you debug your apps ?

Most Liked Responses

rvirding

rvirding

Creator of Erlang

You have to be very careful when debugging things in a concurrent environment, at least when you debug in a more traditional way which stops and controls execution. Anything that is waiting for the debugged process will hang and in many cases may time out and crash, which is not what was intended. Also doing something like IEx.pry in a function which is called in many processes will also be interesting.

Sorry to sound very negative here but having very concurrent systems does change you need to work with them. Sometimes IO.inspect is all that is reasonable. Or use the built-in tracing facilities.

Robert

Qqwy

Qqwy

TypeCheck Core Team

Because of the ability to run multiple Erlang applications side-by-side in the same process and because of metaprogramming awesomeness, one of the fancy things you can do is IEX.pry(after you require IEx in the module) , which starts a shell at that current location in the code, so you can debug the scope you are in.

The cool thing about IO.inspect by the way is that you can plug it in everywhere in your pipelines without altering the result:

(1..10)
|> IO.inspect
|> Enum.map(fn x -> x * x end) 
|> IO.inspect
|> Enum.sum
|> IO.inspect

gausby

gausby

I think that we, as a community, need to study our options for inspecting our applications. As others has mentioned in this thread: The Beam is a different beast. Introducing break points changes the program and such.

Personally I have to look into this book: http://www.erlang-in-anger.com. It is another Erlang book, but learning a little bit of Erlang goes a long way :)—it describes strategies for tracing and probing a running Erlang system.

Where Next?

Popular in Questions Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30877 112
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 53690 245
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
marick
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I’m a nov...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement