<h2>Logging<aclass="headerlink"href="#logging"title="Permalink to this headline">¶</a></h2>
<p>Logs are stored to the logs subdirectory of the node directory and are rotated from time to time. You can
have logging printed to the console as well by passing the <codeclass="docutils literal"><spanclass="pre">--log-to-console</span></code> command line flag. Corda
uses the log4j2 framework to manage its logging, so you can also configure it in more detail by writing
a custom logging configuration file and passing <codeclass="docutils literal"><spanclass="pre">-Dlog4j.configurationFile=my-config-file.xml</span></code> on the
<p>The username and password can be altered in the <aclass="reference internal"href="corda-configuration-files.html"><spanclass="doc">The Corda Configuration File</span></a> but default to username “sa” and a blank
<p>Any database browsing tool that supports JDBC can be used, but if you have IntelliJ Ultimate edition then there is
a tool integrated with your IDE. Just open the database window and add an H2 data source with the above details.
You will now be able to browse the tables and row data within them.</p>
</div>
<divclass="section"id="monitoring-your-node">
<h2>Monitoring your node<aclass="headerlink"href="#monitoring-your-node"title="Permalink to this headline">¶</a></h2>
<p>Like most Java servers, the node exports various useful metrics and management operations via the industry-standard
<aclass="reference external"href="https://en.wikipedia.org/wiki/Java_Management_Extensions">JMX infrastructure</a>. JMX is a standard API
for registering so-called <em>MBeans</em> ... objects whose properties and methods are intended for server management. It does
not require any particular network protocol for export. So this data can be exported from the node in various ways:
some monitoring systems provide a “Java Agent”, which is essentially a JVM plugin that finds all the MBeans and sends
them out to a statistics collector over the network. For those systems, follow the instructions provided by the vendor.</p>
<p>Sometimes though, you just want raw access to the data and operations itself. So nodes export them over HTTP on the
<codeclass="docutils literal"><spanclass="pre">/monitoring/json</span></code> HTTP endpoint, using a program called <aclass="reference external"href="https://jolokia.org/">Jolokia</a>. Jolokia defines the JSON
and REST formats for accessing MBeans, and provides client libraries to work with that protocol as well.</p>
<p>Here are a few ways to build dashboards and extract monitoring data for a node:</p>
<ulclass="simple">
<li><aclass="reference external"href="https://github.com/logzio/jmx2graphite">JMX2Graphite</a> is a tool that can be pointed to /monitoring/json and will
scrape the statistics found there, then insert them into the Graphite monitoring tool on a regular basis. It runs
in Docker and can be started with a single command.</li>
<li><aclass="reference external"href="https://github.com/jmxtrans/jmxtrans">JMXTrans</a> is another tool for Graphite, this time, it’s got its own agent
(JVM plugin) which reads a custom config file and exports only the named data. It’s more configurable than
JMX2Graphite and doesn’t require a separate process, as the JVM will write directly to Graphite.</li>
<li><em>Java Mission Control</em> is a desktop app that can connect to a target JVM that has the right command line flags set
(or always, if running locally). You can explore what data is available, create graphs of those metrics, and invoke
management operations like forcing a garbage collection.</li>
<li>Cloud metrics services like New Relic also understand JMX, typically, by providing their own agent that uploads the
<h2>Uploading and downloading attachments<aclass="headerlink"href="#uploading-and-downloading-attachments"title="Permalink to this headline">¶</a></h2>
<p>Attachments are files that add context to and influence the behaviour of transactions. They are always identified by
hash and they are public, in that they propagate through the network to wherever they are needed.</p>
<p>All attachments are zip files. Thus to upload a file to the ledger you must first wrap it into a zip (or jar) file. Then
you can upload it by running this command from a UNIX terminal:</p>
<p>The attachment will be identified by the SHA-256 hash of the contents, which you can get by doing:</p>
<divclass="highlight-shell"><divclass="highlight"><pre><span></span>shasum -a <spanclass="m">256</span> file.zip
</pre></div>
</div>
<p>on a Mac or by using <codeclass="docutils literal"><spanclass="pre">sha256sum</span></code> on Linux. Alternatively, the hash will be returned to you when you upload the
attachment.</p>
<p>An attachment may be downloaded by fetching:</p>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.