diff --git a/docs/site/Running-debugging-apps.md b/docs/site/Running-debugging-apps.md new file mode 100644 index 000000000000..8dbb8b2e525f --- /dev/null +++ b/docs/site/Running-debugging-apps.md @@ -0,0 +1,22 @@ +--- +title: "Running and debugging apps" +lang: en +keywords: LoopBack 4.0, LoopBack 4, Debug +sidebar: lb4_sidebar +permalink: /doc/en/lb4/Running-and-debugging-apps.html +summary: +--- + +In general, when you are developing an application, use the `node` command to run it. +This enables you to see stack traces and console output immediately. + +For example: + +``` +$ cd myapp +$ node . +``` + +LoopBack 4 also allows you to specify debug strings that the application will display to the console (or save to a file) to help you verify or diagnose the app. See [Setting debug strings](Setting-debug-strings.md). + + \ No newline at end of file diff --git a/docs/site/Setting-debug-strings.md b/docs/site/Setting-debug-strings.md new file mode 100644 index 000000000000..4e3c883b44e1 --- /dev/null +++ b/docs/site/Setting-debug-strings.md @@ -0,0 +1,318 @@ +--- +title: "Setting debug strings" +lang: en +keywords: LoopBack 4.0, LoopBack 4, base-connector.js +sidebar: lb4_sidebar +permalink: /doc/en/lb4/Setting-debug-strings.html +summary: +--- + +You can specify debug strings when you run an application, as explained below, to display specific log output to the console. +You can also redirect the output to a file, if desired. These techniques are often helpful in debugging applications. + +## Using debug strings + +LoopBack has a number of built-in debug strings to help with debugging.Specify a string on the command-line via an environment variable as follows: + +**MacOS and Linux** + +```shell +$ DEBUG=[,...] node . +``` + +**Windows** + +```shell +C:\> set DEBUG=[,...] +C:\> node . +``` + +where <_pattern_> is a string-matching pattern specifying debug strings to match. You can specify as many matching patterns as you wish. + +For example (MacOS and Linux): + +```shell +$ DEBUG=loopback:datasource node . +``` + +Or, on Windows: + +```shell +C:\> set DEBUG=loopback:datasource +C:\> node . +``` + +You'll see output such as (truncated for brevity): + +``` +loopback:datasource Settings: {"name":"db","debug":true} -0ms +loopback:datasource Settings: {"name":"geo","connector":"rest",... +``` + +You can use an asterisk  (`*`) in the pattern to match any string. For example the following would match any debug string containing "oracle": + +```shell +$ DEBUG=*oracle node . +``` + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-rest-crud:*` would include all debuggers except those starting with "rest-crud:". + +## Debug string format + +These strings have the format + +`module[:area]:string` + +Where: + +* _module_ is the name of the module, for example `loopback` or `loopback-connector-mongodb`. +* _area_ is an optional identifier such as `cli` or `repository` to identify the purpose of the module +* _string_ is the debug string specified in the target TypeScript/JavaScript source file, such as `application.ts`. + +For example: + +`loopback:cli:model-generator` + +The debug string `model-generator` is specified in the source file [`generators/model/index.js`](https://github.com/strongloop/loopback-next/blob/master/packages/cli/generators/model/index.js) of the `@loopback/cli` module. + +## Debug strings reference + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ModuleSource fileString
@loopback
@loopback/authorizationsrc/authorize-interceptor.tsloopback:authorization:interceptor
@loopback/bootsrc/bootstrapper.tsloopback:boot:bootstrapper
src/booters/interceptor.booter.tsloopback:boot:interceptor-booter
src/booters/lifecycle-observer.booter.tsloopback:boot:lifecycle-observer-booter
src/booters/model-api.booter.tsloopback:boot:model-api
src/booters/service.booter.tsloopback:boot:service-booterr
@loopback/booter-lb3appsrc/lb3app.booter.tsloopback:boot:lb3app
@loopback/cronsrc/cron.component.tsloopback:cron
@loopback/rest-crudsrc/crud-rest-builder.tsloopback:boot:crud-rest
@loopback/cliplease check each generatorloopback:cli:_string_
@loopback/contextsrc/interceptor.tsloopback:context:interceptor
src/binding.tsloopback:context:bindging
src/context-view.tsloopback:context:view
src/invocation.tsloopback:context:invocation
src/interceptor-chain.tsloopback:context:interceptor-chain
@loopback/http-caching-proxysrc/http-caching-proxy.tsloopback:http-caching-proxy
@loopback/coresrc/lifecycle-registry.tsloopback:core:lifecycle
src/application.tsloopback:core:application
@loopback/openapi-v3src/*loopback:openapi
@loopback/repositorysrc/relations/belongs-to/belongs-to-accessor.tsloopback:repository:belongs-to-accessor
src/relations/has-many/has-many-repository-factory.tsloopback:repository:has-many-repository-factory
src/relations/has-one/has-one-repository-factory.tsloopback:repository:has-one-repository-factory
@loopback/repository-json-schemasrc/build-schema.tsloopback:repository-json-schema:build-schema
@loopback/restsrc/rest-server/loopback:rest:server
src/sequence.tsloopback:rest:sequence
loopback-datasource-juggler
lib/datasource.jsloopback:datasource
Connectors
loopback-connectorlib/connector.jsloopback:connector
loopback-connector-cassandralib/cassandra.jsloopback:connector:cassandra
loopback-connector-cloudantlib/cloudant.jsloopback:connector:cloudant
loopback-connector-couchdb2lib/couchdb2.jsloopback:connector:couchdb2
loopback-connector-dashdblib/dashdb.jsloopback:connector:dashdb
loopback-connector-db2lib/db2.jsloopback:connector:db2
loopback-connector-ibmilib/ibmiconnector.jsloopback:connector:ibmiconnector
loopback-connector-kv-redislib/kv-redis.jsloopback:connector:kv-redis
loopback-connector-mongodblib/mongodb.jsloopback:connector:mongodb
loopback-connector-mssqllib/mssql.jsloopback:connector:mssql
loopback-connector-mysqllib/mysql.jsloopback:connector:mysql
loopback-connector-oraclelib/oracle.jsloopback:connector:oracle
loopback-connector-postgresqllib/postgresql.jsloopback:connector:postgresql
loopback-connector-restlib/rest-builder.jsloopback:connector:rest
lib/rest-connector.jsloopback:connector:rest
lib/rest-model.jsloopback:connector:rest
lib/swagger-client.jsloopback:connector:rest:swagger
loopback-connector-soaplib/soap-connector.jsloopback:connector:soap
diff --git a/docs/site/sidebars/lb4_sidebar.yml b/docs/site/sidebars/lb4_sidebar.yml index 5cd3fd1643d2..e09b72104703 100644 --- a/docs/site/sidebars/lb4_sidebar.yml +++ b/docs/site/sidebars/lb4_sidebar.yml @@ -192,6 +192,15 @@ children: url: Database-migrations.html output: 'web, pdf' + - title: 'Running and debugging apps' + url: Running-and-debugging-apps.html + output: 'web, pdf' + children: + + - title: 'Setting debug strings' + url: Setting-debug-strings.html + output: 'web, pdf' + - title: 'Call Other Services' url: Calling-other-APIs-and-web-services.html output: 'web, pdf'