How to enable cloudwatch logs for API Gateway?

I want to enable cloud watch logs for my rest api via serverless.
I have used
provider:
name: aws
runtime: java8
cfLogs: true
logs:
restApi: # Optional configuration which specifies if API Gateway logs are used. This can either be set to true to use defaults, or configured via subproperties.
accessLogging: true # Optional configuration which enables or disables access logging. Defaults to true.
#format: ‘requestId: $context.requestId’ # Optional configuration which specifies the log format to use for access logging.
executionLogging: true # Optional configuration which enables or disables execution logging. Defaults to true.
level: INFO # Optional configuration which specifies the log level to use for execution logging. May be set to either INFO or ERROR.
fullExecutionData: true # Optional configuration which specifies whether or not to log full requests/responses for execution logging. Defaults to true.
#role: arn:aws:iam::123456:role # Existing IAM role for ApiGateway to use when managing CloudWatch Logs. If ‘role’ is not configured, a new role is automatically created.
roleManagedExternally: false #

for creating cloudwatch logs.
Logs have been created successfully. but it is done by calling updateStage by serverless. I have enables Serverless debug logs and seen:
Serverless: [AWS sts 200 1.241s 0 retries] getCallerIdentity({})
Serverless: [AWS apigateway 200 1.241s 0 retries] getRestApis({ position: undefined, limit: 500 })
Serverless: [AWS apigateway 200 1.28s 0 retries] getStage({ restApiId: ‘’, stageName: ‘dev’ })
Serverless: [AWS apigateway 200 1.438s 0 retries] updateStage({ restApiId: '’,
stageName: ‘dev’,
patchOperations:
[ { op: ‘replace’,
path: ‘/accessLogSettings/destinationArn’,
value: 'arn:aws:logs:
’ },
{ op: ‘replace’,
path: ‘/accessLogSettings/format’,
value: ‘requestId: $context.requestId, ip: $context.identity.sourceIp, caller: $context.identity.caller, user: $context.identity.user, requestTime: $context.requestTime, httpMethod: $context.httpMethod, resourcePath: $context.resourcePath, status: $context.status, protocol: $context.protocol, responseLength: $context.responseLength’ },
{ op: ‘replace’, path: ‘///logging/dataTrace’, value: ‘true’ },
{ op: ‘replace’, path: ‘///logging/loglevel’, value: ‘INFO’ },

So, i found that it is not being enabled by cloud formation template.
Please suggest a way to create it inside cloud formation template. I want to use same template in other environments.