Skip to content
This repository has been archived by the owner on Jan 9, 2021. It is now read-only.

Commit

Permalink
Add debug-log documentation and enable it by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbrdo committed Jul 5, 2014
1 parent f3336dc commit 2d66c44
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 19 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ sgminer-specific configuration options:
--disable-adl Override detection and disable building with adl
--disable-adl-checks
--without-curses Do not compile support for curses TUI

#### Debian Example

apt-get install libcurl4-openssl-dev pkg-config libtool libncurses5-dev
Expand Down Expand Up @@ -419,10 +419,9 @@ file and any changes that may have been made.

sgminer will log to stderr if it detects stderr is being redirected to a
file. To enable logging simply append `2>logfile.txt` to your command line
and `logfile.txt` will contain the logged output at the log level you
specify (normal, verbose, debug etc.). If you use the `--debug-log` option
then everything will be logged to the file (console output will remain as
configured).
and `logfile.txt` will contain all debug output unless you set `debug-log`
to `false`, in which case it will only contain output at the log level you
specified (notice by default).

There is also the -m option on Linux which will spawn a command of your choice
and pipe the output directly to that command.
Expand Down
45 changes: 31 additions & 14 deletions doc/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The example below has `algorithm` set at the global level. Anytime a pool or pro
...
```

In the example below, `algorithm` is not specified at the global level and no profile is used as `default-profile`. This means that the default profile's `algorithm` will be set to sgminer's core default: "scrypt".
In the example below, `algorithm` is not specified at the global level and no profile is used as `default-profile`. This means that the default profile's `algorithm` will be set to sgminer's core default: "scrypt".
```
{
"pools": [
Expand Down Expand Up @@ -98,7 +98,7 @@ See the [configuration settings order](#configuration-settings-order) for more i

## Working with Profiles and Pool Specific Settings

Profiles have been added assist in specifying different GPU and/or algorithm settings that could be (re-)used by one or more pools. Pool-specific settings will override profile settings, and profile settings will override the default profile/globals.
Profiles have been added assist in specifying different GPU and/or algorithm settings that could be (re-)used by one or more pools. Pool-specific settings will override profile settings, and profile settings will override the default profile/globals.

See the [configuration settings order](#configuration-settings-order) for more information about the order in which settings are applied.

Expand Down Expand Up @@ -138,7 +138,7 @@ See the [configuration settings order](#configuration-settings-order) for more i
"gpu-engine":"1100"
}
```
In the example above, when using the second pool, Profile A is applied, which sets the `algorithm` to "darkcoin-mod", but since a `gpu-engine` of "1000" is specified in the pool, the value of "1050" is discarded.
In the example above, when using the second pool, Profile A is applied, which sets the `algorithm` to "darkcoin-mod", but since a `gpu-engine` of "1000" is specified in the pool, the value of "1050" is discarded.

A similar situation occurs in the third pool. No profile is specified so the default `algorithm` "ckolivas" is set along with the default `gpu-engine` of "1100". Because `intensity` is set to "13" in the pool, the default profile's value of "19" is discarded.

Expand Down Expand Up @@ -175,7 +175,7 @@ The end result of the above would look like this:

## Include and Includes

`include` and `includes` are special keywords only available in the configuration file. You can include json-formatted files at any level of the configuration parsing. The values read in the included
`include` and `includes` are special keywords only available in the configuration file. You can include json-formatted files at any level of the configuration parsing. The values read in the included
files are applied to the current object being parsed.

`include` is used to include one single file. If you want to include multiple files, use `includes`, which is an array of filenames.
Expand Down Expand Up @@ -245,7 +245,7 @@ There is no limit as to how includes can be used as long as they follow proper j

### config

Load a JSON-formatted configuration file. See `example.conf` for an example configuration file.
Load a JSON-formatted configuration file. See `example.conf` for an example configuration file.

The filename can also be a web or ftp url for remote configuration files. The file will be downloaded locally before being loaded. **Note:** If a file by the same name exists, it will be overwritten. If you modify and save your configuration, the changes will only be made locally and future downloads will overwrite your changes. **Also note** that the remote configuration files are only available with `libcurl`.

Expand Down Expand Up @@ -319,7 +319,7 @@ Displays the number of GPUs detected, Open CL/ADL platform information and then
```
# ./sgminer -n
[10:16:04] CL Platform vendor: Advanced Micro Devices, Inc.
[10:16:04] CL Platform name: AMD Accelerated Parallel Processing
[10:16:04] CL Platform name: AMD Accelerated Parallel Processing
[10:16:04] CL Platform version: OpenCL 1.2 AMD-APP (1348.5)
[10:16:04] Platform devices: 2
[10:16:04] 0 Tahiti
Expand Down Expand Up @@ -456,6 +456,7 @@ sgminer 4.2.1-116-g2e8b-dirty
* [Miscellaneous Options](#miscellaneous-options)
* [compact](#compact)
* [debug](#debug)
* [debug-log](#debug-log)
* [default-profile](#default-profile)
* [device](#device)
* [difficulty-multiplier](#difficulty-multiplier)
Expand Down Expand Up @@ -488,7 +489,7 @@ sgminer 4.2.1-116-g2e8b-dirty
* [text-only](#text-only)
* [verbose](#verbose)
* [worktime](#worktime)

---

## API Options
Expand Down Expand Up @@ -697,7 +698,7 @@ Port to use for API.

### algorithm

**Formerly the kernel option.** Sets the algorithm to use for mining.
**Formerly the kernel option.** Sets the algorithm to use for mining.

*Available*: Global, Pool, Profile

Expand Down Expand Up @@ -731,7 +732,7 @@ Set GPU lookup gap for scrypt mining.

### nfactor

Overrides the default scrypt parameter N, specified as the factor of 2 (`N = 2^nfactor`).
Overrides the default scrypt parameter N, specified as the factor of 2 (`N = 2^nfactor`).

*Available*: Global, Pool, Profile

Expand Down Expand Up @@ -1088,7 +1089,7 @@ Set the GPU voltage in Volts.

### intensity

Intensity of GPU scanning.
Intensity of GPU scanning.

Overridden by [xintensity](#xintensity) and [rawintensity](#rawintensity).

Expand Down Expand Up @@ -1138,7 +1139,7 @@ Do not attempt to restart GPUs that hang.

### rawintensity

Raw intensity of GPU scanning.
Raw intensity of GPU scanning.

Overriddes by [intensity](#intensity) and [xintensity](#xintensity).

Expand Down Expand Up @@ -1228,7 +1229,7 @@ Used with [auto-fan](#auto-fan) and [auto-gpu](#auto-gpu).

### xintensity

Shader based intensity of GPU scanning.
Shader based intensity of GPU scanning.

Overridden by [rawintensity](#rawintensity) and overrides [intensity](#intensity).

Expand Down Expand Up @@ -1704,9 +1705,9 @@ See [lookup-gap](#lookup-gap).

### [profile-]name

Set a name for a profile.
Set a name for a profile.

**Note** if no profile name is set, the profile name defaults to the profile number in the order that
**Note** if no profile name is set, the profile name defaults to the profile number in the order that
it was entered starting with `0`.

*Available*: Profile
Expand Down Expand Up @@ -1793,6 +1794,22 @@ Enable debug output.

[Top](#configuration-and-command-line-options) :: [Config-file and CLI options](#config-file-and-cli-options) :: [Miscellaneous Options](#miscellaneous-options)

### debug-log

Enable debug logging when stderr is redirected to file.

*Available*: Global

*Config File Syntax:* `"debug-log":false`

*Command Line Syntax:* `--debug-log`

*Argument:* None

*Default:* `true`

[Top](#configuration-and-command-line-options) :: [Config-file and CLI options](#config-file-and-cli-options) :: [Miscellaneous Options](#miscellaneous-options)

### default-profile

Use this profile for sgminer's default settings.
Expand Down
3 changes: 3 additions & 0 deletions sgminer.c
Original file line number Diff line number Diff line change
Expand Up @@ -8202,6 +8202,9 @@ int main(int argc, char *argv[])
sigaction(SIGINT, &handler, &inthandler);
#endif

/* enable debug output to file by default is stderr is redirected to a file */
opt_debug = !isatty(fileno((FILE *)stderr));

/* opt_kernel_path defaults to SGMINER_PREFIX */
opt_kernel_path = (char *)alloca(PATH_MAX);
strcpy(opt_kernel_path, SGMINER_PREFIX);
Expand Down

0 comments on commit 2d66c44

Please sign in to comment.