ember.js Debugging Logging EmberData


The ember data models have a toJSON method that extracts the relevant data:


This method uses the JSONSerializer to create the JSON representation.

If you want to log the data in a more app-specific way, you can use serialize:


which uses the serialization strategy you can define in the store's adapter to create a JSON representation of the model.

All objects in an Ember app, including Ember Data models, inherit from Ember.CoreObject, which has a toString method that prints this representation:



  • app-name is the name of your application
  • ember-type is the ember type of the object you are logging (can be controller, route etc.)
  • object-name is the name of the object you are logging (name of your model, or controller, or route etc.)
  • id is either a guId create with Ember.guidFor or, for example, the model's id.

You can overwrite this value using the method toStringExtension in your particular model.

For comparison example, here's how logging an application controller could look: