Starcounter
HomeDownloadDocsCommunity
2.3.1
2.3.1
  • Starcounter Documentation
  • Getting Started
  • Starcounter
    • Collapsing the Stack
      • Complexity and Scalability Tradeoff
      • The Future of Micro-Services
      • 10 Benefits of Collapsing the Stack
    • Integrated Database and Web Server
  • Hello World - Tutorial
    • Create a Database Class
    • Create a Real Time UI
    • First Interactive UI
    • Computed Properties
    • Expense Tracker
    • Cancel and Delete
    • The Next Step
  • Guides
    • Database
      • Database Classes
      • Data manipulation
      • Object Identity and Object References
      • Querying with SQL
      • Data Types
      • Relations
      • Inheritance
      • Sharing data
      • Database Configuration
      • Comparing Database Objects
      • Referential Integrity and Constraints
    • SQL
      • Identifiers
      • Path Expressions
      • Data operators
      • Joins
      • Aggregates
      • Comparisons and Logical Operators
      • Sorting
      • Fetch
      • Offset Key
      • Indexes
      • Literals
      • Query Plan Hints
      • Reserved words
      • Query for Database Classes
      • SQL Isolation Between Applications
    • Transactions
      • Short-Running Transactions
      • Long running transactions
      • Using Transactions
      • Running Background Jobs
      • Commit Hooks
    • Typed JSON
      • JSON-by-example
      • Code-Behind
      • Data Bindings
      • Callback Methods
      • Responding with JSON
      • Accepting JSON in Requests
      • Primitive Arrays and Single Value Types
      • Typed JSON Internals
    • Blendable Web Apps
      • Starcounter MVVM
      • Palindrom
      • Client-Side Stack
      • Sessions
      • HTML Views
      • App Shell
      • Web Components
      • View Attaching
      • View Composing
      • HTML Compositions
      • HTML Views Blending Guidelines
      • Avoiding CSS conflicts
      • Debugging
    • Network
      • HTTP
      • Internal Self Calls
      • Middleware
      • Anonymous or Substitute Handlers
      • URL Aliases and Redirects
      • Network Gateway
      • Static File Server
      • External HTTP Calls
      • WebSocket
      • Avoiding URI conflicts
      • TCP Sockets
      • UDP Sockets
    • Publishing Apps
    • Working with Starcounter
      • Release Channels
      • Starting and Stopping Apps
      • Administrator Web UI
      • Star CLI
      • StarAdmin CLI
      • StarDump CLI
      • Working in Visual Studio
      • Error Log
      • Using HTTPS on NGINX
      • Using HTTPS on IIS
      • Run Starcounter in Production
      • Weaver
      • Investigating App Crashes
      • Configuration Structure
      • Database Refactoring
      • Using Unload/Reload to Modify Database Schema
      • Kernel Questions and Answers
      • Log Files
  • Cookbook
    • Attach an HTTP Request to an Existing Long-Running Transaction
    • Cookie-Based Authentication
    • Timestamp on Object Creation
    • Creating Strongly Typed JSON Collections
    • Migrating From 2.2 to 2.3+
    • Multiple Pages
    • Icons
    • Proposed Project Structure
    • Acceptance Testing with Selenium
    • Requesting a User to Authenticate
    • How to delete unused tables and columns
Powered by GitBook
On this page
  • Introduction
  • How to Access the Error Log
  • Using Administrator Web UI
  • Using Command-Line Tools
  • Using StarAdmin CLI
  • Using star CLI
  • Viewing the Raw File
  • Writing to the Error Log
  • Diagnostic Logging
  • Conditional Low-Level Trace Logging
  1. Guides
  2. Working with Starcounter

Error Log

PreviousWorking in Visual StudioNextUsing HTTPS on NGINX

Last updated 7 years ago

Introduction

The Starcounter error log contains detailed information about warnings and errors. Whenever an error occurs, and whenever a component of Starcounter needs to issue a warning or a notice, a detailed message with the relevant severity is written to the error log.

How to Access the Error Log

Using Administrator Web UI

You can access the error log via the Administrator Web UI. To view the error log on your machine:

  1. Open a browser

  2. Navigate to .

Using Command-Line Tools

There are two ways to view the content of the log using the command-line tools: via staradmin.exe and via star.exe.

Using StarAdmin CLI

For greatest flexibility, use staradmin.exe. Type staradmin list --max=50 log to see the 50 most recent log entries.

By default, staradmin list log will show you the 25 latest logged entries with severity Notice and higher (i.e. including Warning and Error, but not Debug).

Examples. To see,

  1. all entries (Notice and up), type staradmin list --max=all log.

  2. the 100 latest entries, including Debug, type staradmin log --max=100 debug.

  3. all entries (Notice and up), type staradmin list --max=all log.

  4. the 100 latest entries, including Debug, type staradmin list --max=100 log debug.

  5. all errors, type staradmin list --max=all log errors

  6. the 20 latest errors and warnings, type staradmin list --max=20 log warnings.

  7. the 50 latest entries, independent of their severity, logged by the "Starcounter" log source, type staradmin --max=50 list log all Starcounter.

Finally, entries displayed by staradmin list log can be filtered by a named database by applying the global -d option. For example, to see the 10 last entries from the Starcounter.Host source, logging from within the default database, type staradmin -d=default list --max=10 log all Starcounter.Host.

Using star CLI

You can instruct star.exe to display log entries scoped to the operation star executes, for example starting an application. You do this using the new --logs option.

Typing star --logs app.exe will first start "app.exe" and then output all log entries that was written to the log from the time when the command was invoked. By default, logs with Notice and up is displayed. To see debug logs too, instead type star --verbose --logs app.exe.

Viewing the Raw File

You can also see the direct content of the log by browsing the file content on your hard drive. To do this,

  1. Locate the root server directory of your Starcounter installation. The default path for the personal server is: C:\Users\[YourName]\Documents\Starcounter\Personal.

    • In older versions of Starcounter, it was: C:\Users\[YourName]\Documents\Starcounter\[Version]\Personal

  2. Open the Logs subdirectory.

The log data is in one or more files named with the convention Starcounter.[nnnnnnnnnn].log where [nnnnnnnnnn] is an opaque sequence number used by Starcounter. If you see several files, the one with the highest number contains the most recent entries.

Writing to the Error Log

Not only Starcounter components can write to the log. Applications running in Starcounter can do so too. Writing to the log is done using the LogSource class, part of the Starcounter.Logging namespace.

using Starcounter;
using Starcounter.Logging;

class Program
{
    static void Main()
    {
        new LogSource("PerSamuelsson").LogWarning("I dont do any good!");
    }
}

If you run the above application using star app.cs, viewing the logged entry can be done with the staradmin list log command, using staradmin list log all PerSamuelsson.

The LogSource class has support for logging errors (critical, text, and from exceptions), warnings and notices. Invoking any of the corresponding LogSource methods, such as LogWarning above, will assure the message ends up in the log.

Diagnostic Logging

In addition to errors, warnings and notices, Starcounter also allows diagnostic logging using the Debug and Trace methods respectively. Logging using the Debug method will only be available in Starcounter versions built with the DEBUG configuration. Similarly, logging using the Trace method will only be available in Starcounter versions built with the TRACE configuration.

Conditional Low-Level Trace Logging

Various Starcounter components also support low-level diagnostics in Starcounter TRACE builds by enabling trace logging. With trace logging turned on, trace messages emitted by the Starcounter runtime is routed to the log using the Debug severity. Trace logging is an experimental feature and should not be considered future compatible. It is driven by an environment variable, SC_ENABLE_TRACE_LOGGING. To set this flag and thereby effectively enable trace logging for a set of Starcounter components, make sure all Starcounter processes are stopped and apply the --tracelogging flag to scservice.exe.

staradmin kill all
start scservice --tracelogging
http://localhost:8181/#/server/log