# Logs and status

Grayspar keeps what your service prints to its standard output and standard error, so you can see what happened when something goes wrong. The dashboard shows the same logs in each service's menu.

## Read a service's logs

To print what a service has printed, with the time on each line, run `grayspar logs`. To keep following new lines as they arrive, add `-f`:

```sh
grayspar logs
grayspar logs -f
```

When a project has several services, name the service with `--service`:

```sh
grayspar logs --service api
```

Grayspar keeps log lines for a period set by your plan. An app that prints in a tight loop has some of its lines dropped.

## Read a build log

To read the log of the last build, add `--build`. To follow a build that is still running, add `-f` as well:

```sh
grayspar logs --build
```

When a build fails, `grayspar deploy` prints the end of the build log, along with this command for the rest. When a service builds and then fails to start, `grayspar deploy` points you to `grayspar logs`.

## Restart a service

To start a fresh copy of the running version, run `grayspar restart`. The copy keeps the same image, variables and volume, and nothing is built:

```sh
grayspar restart
```

```text frame="terminal"
Restarting app.
To follow it, run
grayspar status
```

A restart deletes the files your app wrote outside its volume. An app that crashes also starts again by itself, and Grayspar waits a little longer after each crash.

## Check a service's status

To see each service's address and status, run `grayspar status`:

```text frame="terminal"
<project-name>

SERVICE    URL                                   STATUS
app        https://<project-name>.grayspar.com   Running
```

Each service shows one of six statuses:

| Status     | Meaning                                                                       |
| ---------- | ----------------------------------------------------------------------------- |
| Deploying  | A new version is starting and hasn't gone live yet.                           |
| Running    | The service is up.                                                            |
| Restarting | A fresh copy is starting.                                                     |
| Crashed    | The app has stopped.                                                          |
| Unknown    | Grayspar hasn't heard from the server running this service for a short while. |
| Failed     | The first deploy never went live.                                             |

When an app stops answering, or nothing has gone live yet, the people you shared the project with see a page saying so at the project's address. Refreshing that page tries again.